diff options
author | Guido Günther <agx@sigxcpu.org> | 2012-07-03 21:49:05 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-07-03 21:51:08 +0200 |
commit | d3ee4b0cb3fdbf06aac954eeb50715c74705b9b7 (patch) | |
tree | a8c055cd55c1cc345ac349cc2a39fd130333f64c | |
parent | 4d56ab643100776171a66bff9686ff7f676ad1c5 (diff) | |
download | git-buildpackage-d3ee4b0cb3fdbf06aac954eeb50715c74705b9b7.tar.gz git-buildpackage-d3ee4b0cb3fdbf06aac954eeb50715c74705b9b7.tar.bz2 git-buildpackage-d3ee4b0cb3fdbf06aac954eeb50715c74705b9b7.zip |
GitRepository: Make rev_parse's short option an int everywhere
-rw-r--r-- | gbp/git/repository.py | 4 | ||||
-rw-r--r-- | tests/test_GitRepository.py | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 5d33fc70..c04bbc51 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -602,7 +602,7 @@ class GitRepository(object): # an empty repo has no branches: return False if self.branch else True - def rev_parse(self, name, short=None): + def rev_parse(self, name, short=0): """ Find the SHA1 of a given name @@ -614,7 +614,7 @@ class GitRepository(object): @rtype: C{str} """ args = GitArgs("--quiet", "--verify") - args.add_cond(short, '--short=%s' % short) + args.add_cond(short, '--short=%d' % short) args.add(name) sha, ret = self._git_getoutput('rev-parse', args.args) if ret: diff --git a/tests/test_GitRepository.py b/tests/test_GitRepository.py index 27dc291e..244070ce 100644 --- a/tests/test_GitRepository.py +++ b/tests/test_GitRepository.py @@ -561,7 +561,12 @@ def test_checkout(): Traceback (most recent call last): ... GitRepositoryError: revision 'doesnotexist' not found + >>> sha1 = repo.rev_parse('master', short=10) + >>> len(sha1) + 10 >>> sha1 = repo.rev_parse('master') + >>> len(sha1) + 40 >>> repo.checkout(sha1) >>> repo.branch >>> repo.get_branch() |