return full_revision
def _rcs_revision_id(self, index):
args = ["rev-list", "--first-parent", "--reverse", "HEAD"]
- status,output,error = self._u_invoke_client(*args)
+ kwargs = {"expect":(0,128)}
+ status,output,error = self._u_invoke_client(*args, **kwargs)
+ if status == 128:
+ if error.startswith("fatal: ambiguous argument 'HEAD': unknown "):
+ return None
+ raise rcs.CommandError(args, status, error)
commits = output.splitlines()
try:
return commits[index]
kwargs = {"expect": (0,255)}
status,output,error = self._u_invoke_client(*args, **kwargs)
if status == 0:
- return output.strip()
+ id = output.strip()
+ if id == '000000000000':
+ return None # before initial commit.
+ return id
return None
\f
self.failUnlessEqual(self.rcs.revision_id(i), None)
self.failUnlessEqual(self.rcs.revision_id(-i-1), None)
+ def test_revision_id_as_committed(self):
+ """Check revision id before first commit"""
+ if not self.rcs.versioned:
+ self.failUnlessEqual(self.rcs.revision_id(5), None)
+ return
+ committed_revisions = []
+ for path in self.test_files:
+ self.failUnlessEqual(self.rcs.revision_id(0), None)
+
class RCS_duplicate_repo_TestCase(RCSTestCase):
"""Test cases for RCS.duplicate_repo method."""