diff options
author | Colin Walters <walters@verbum.org> | 2010-03-08 10:32:34 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2010-03-08 10:32:34 -0500 |
commit | a4eea738dadd7ad1475421622438d265379a47e6 (patch) | |
tree | 48d4683a7958b331145eec1782b20c5f69f911bb | |
parent | c510e24113d3c86764d5937376295e97708cd6c2 (diff) | |
download | fedpkg-make-pull-a4eea738dadd7ad1475421622438d265379a47e6.tar.gz fedpkg-make-pull-a4eea738dadd7ad1475421622438d265379a47e6.tar.xz fedpkg-make-pull-a4eea738dadd7ad1475421622438d265379a47e6.zip |
[fedpkg-vcs] Use abbreviated id for git commits
-rwxr-xr-x | fedpkg-vcs | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -43,17 +43,20 @@ class Vcs(object): def checkout(self, destdir): """Retrieve a new copy of the source tree, saving as destdir""" - pass + raise Exception("not implemented") def update(self, directory): """Update directory from the latest upstream""" - pass + raise Exception("not implemented") def get_scheme(self): return self._parsed_url.scheme def get_id(self, directory): - pass + raise Exception("not implemented") + + def get_abbreviated_id(self, directory): + raise Exception("not implemented") def _vcs_exec(self, *args, **kwargs): print "Running: %r" % (args[0], ) @@ -104,6 +107,10 @@ class GitVcs(Vcs): output = subprocess.Popen(['git', 'show', '--format=%H'], stdout=subprocess.PIPE, cwd=directory).communicate()[0] return output.split('\n')[0] + def get_abbreviated_id(self, directory): + full_id = self.get_id(directory) + return full_id[0:8] + def get_commit_summary_as_filename(self, directory, commitid): output = subprocess.Popen(['git', 'show', '--format=%f', commitid], stdout=subprocess.PIPE, cwd=directory).communicate()[0] return output.split('\n')[0] @@ -354,9 +361,9 @@ def command_pull_update(spec, vcs, vcsdir, args=[], opts={}): name = spec.get_name() version = spec.get_version() - newid = vcs.get_id(vcsdir) + abbrev_id = vcs.get_abbreviated_id(vcsdir) - snapshot_dirname = '%s-%s%s%s' % (name, version, vcs.get_scheme(), newid) + snapshot_dirname = '%s-%s%s%s' % (name, version, vcs.get_scheme(), abbrev_id) snapshot_archivename = snapshot_dirname + '.tar.bz2' subprocess.check_call(['tar', '-cj', r'--transform=s,^\.,' + snapshot_dirname + ',', '-f', '../' + snapshot_archivename, '.'], cwd=vcsdir) @@ -369,7 +376,7 @@ def command_pull_update(spec, vcs, vcsdir, args=[], opts={}): spec.set_source(snapshot_dirname, snapshot_archivename) now = datetime.datetime.now() - alphatag = "%s%s%s" % (now.strftime("%Y%m%d"), vcs.vcstype, newid) + alphatag = "%s%s%s" % (now.strftime("%Y%m%d"), vcs.vcstype, abbrev_id) spec.increment_release_snapshot(alphatag) spec.save() |