Fix Git._vcs_revision_id() offset bug.
authorW. Trevor King <wking@drexel.edu>
Sun, 13 Dec 2009 13:31:33 +0000 (08:31 -0500)
committerW. Trevor King <wking@drexel.edu>
Sun, 13 Dec 2009 13:31:33 +0000 (08:31 -0500)
libbe/storage/vcs/bzr.py
libbe/storage/vcs/git.py
libbe/storage/vcs/hg.py

index c84701921860d0f12a43d3dab0aef363429647b6..7d84415f939c285974c5cb3f2349fbe02efd3037 100644 (file)
@@ -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():
index 0b006f357aacef490d991544ff83a70fbd27d74c..77ddd88762754d998e01ad85a2538ea0efde169f 100644 (file)
@@ -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
 
index f1a7eefc2b021faedd6d281f38fa9b8888a870ad..633987a306f0d4a82781145d63b6f8a64ae7718a 100644 (file)
@@ -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():