From d21c50ece316536b5972725eced19b40d6e2589d Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 13 Dec 2009 08:31:33 -0500 Subject: Fix Git._vcs_revision_id() offset bug. --- libbe/storage/vcs/bzr.py | 5 +++-- libbe/storage/vcs/git.py | 10 ++++++++-- libbe/storage/vcs/hg.py | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'libbe/storage') 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(): -- cgit