diff options
Diffstat (limited to 'rpmci/lame_vcs_abstraction.py')
-rw-r--r-- | rpmci/lame_vcs_abstraction.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/rpmci/lame_vcs_abstraction.py b/rpmci/lame_vcs_abstraction.py index 2d5314e..f798d67 100644 --- a/rpmci/lame_vcs_abstraction.py +++ b/rpmci/lame_vcs_abstraction.py @@ -59,7 +59,7 @@ class Vcs(object): """Update directory from the latest upstream""" raise Exception("not implemented") - def export_archive(self, prefix, target_filename): + def export_archive(self, commit_id, prefix, target_filename): """Export a tarball with minimal (or no) version control data.""" raise Exception("not implemented") @@ -68,6 +68,9 @@ class Vcs(object): def get_id(self): raise Exception("not implemented") + + def resolve_id(self): + raise Exception("not implemented") def get_abbreviated_id(self): raise Exception("not implemented") @@ -117,13 +120,12 @@ class GitVcs(Vcs): assert self._dir is not None return self._vcs_exec_async(['git', 'pull', '-r'], logfile, on_exited) - def export_archive(self, prefix, target_filename, logfile): + def export_archive(self, commit_id, prefix, target_filename, log_output_stream): if not prefix.endswith('/'): prefix += '/' - args = ['git', 'archive', '--format=tar', '--prefix=%s' % (prefix,), 'HEAD'] + args = ['git', 'archive', '--format=tar', '--prefix=%s' % (prefix,), commit_id] logging.info("Synchronously executing: %r" % (args, )) - log_f = open(logfile, 'w') - gitproc = subprocess.Popen(args, cwd=src_directory, stdout=subprocess.PIPE, stderr=log_f) + gitproc = subprocess.Popen(args, cwd=src_directory, stdout=subprocess.PIPE, stderr=log_output_stream) if target_filename.endswith('.bz2'): zipbin = 'bzip2' elif target_filename.endswith('.gz'): @@ -133,7 +135,7 @@ class GitVcs(Vcs): args = [zipbin, '-c'] logging.info("Synchronously executing: %r" % (args, )) f = open(target_filename, 'w') - zipproc = subprocess.Popen(args, cwd=src_directory, stdout=f, stdin=gitproc.stdout, stderr=log_f) + zipproc = subprocess.Popen(args, cwd=src_directory, stdout=f, stdin=gitproc.stdout, stderr=log_output_stream) zipproc.wait() def get_commit_as_patch(self, commitid, destfile): @@ -145,6 +147,10 @@ class GitVcs(Vcs): def get_id(self): output = self._vcs_exec_sync_log_error(['git', 'show', '--format=%H']) return output.split('\n')[0] + + def resolve_id(self, commit_id): + output = self._vcs_exec_sync_log_error(['git', 'rev-parse', commit_id]) + return output.split('\n')[0] def get_abbreviated_id(self): full_id = self.get_id() |