diff options
-rw-r--r-- | libbe/storage/vcs/bzr.py | 5 | ||||
-rw-r--r-- | libbe/storage/vcs/git.py | 10 | ||||
-rw-r--r-- | libbe/storage/vcs/hg.py | 4 |
3 files changed, 13 insertions, 6 deletions
diff --git a/libbe/storage/vcs/bzr.py b/libbe/storage/vcs/bzr.py index c847019..7d84415 100644 --- a/libbe/storage/vcs/bzr.py +++ b/libbe/storage/vcs/bzr.py @@ -26,13 +26,14 @@ import os import os.path import re import shutil -import sys -import unittest import libbe import base + if libbe.TESTING == True: import doctest + import sys + import unittest def new(): diff --git a/libbe/storage/vcs/git.py b/libbe/storage/vcs/git.py index 0b006f3..77ddd88 100644 --- a/libbe/storage/vcs/git.py +++ b/libbe/storage/vcs/git.py @@ -25,14 +25,15 @@ import os import os.path import re import shutil -import sys import unittest import libbe import libbe.ui.util.user import base + if libbe.TESTING == True: import doctest + import sys def new(): @@ -150,7 +151,12 @@ class Git(base.VCS): raise base.CommandError(args, status, stderr=error) commits = output.splitlines() try: - return commits[index] + if index > 0: + return commits[index-1] + elif index < 0: + return commits[index] + else: + return None except IndexError: return None diff --git a/libbe/storage/vcs/hg.py b/libbe/storage/vcs/hg.py index f1a7eef..633987a 100644 --- a/libbe/storage/vcs/hg.py +++ b/libbe/storage/vcs/hg.py @@ -25,14 +25,14 @@ import os import os.path import re import shutil -import sys import libbe import base if libbe.TESTING == True: - import unittest import doctest + import sys + import unittest def new(): |