aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/rcs.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-07-29 15:56:10 -0400
committerW. Trevor King <wking@drexel.edu>2009-07-29 15:56:10 -0400
commitdcfe9d5e292fa4a405fafb4bdd6d9e2070f30fa9 (patch)
treef9e9c8d2ba5190d1a71046cdb5fb3abdc0fcf74f /libbe/rcs.py
parent4e8882e74aad64859a16f17fa6bef8c04b33913d (diff)
parent22a38de80ee11ada710bc6766798ca608f938307 (diff)
downloadbugseverywhere-dcfe9d5e292fa4a405fafb4bdd6d9e2070f30fa9.tar.gz
Merged interactive email interface
Diffstat (limited to 'libbe/rcs.py')
-rw-r--r--libbe/rcs.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/libbe/rcs.py b/libbe/rcs.py
index 294b8e0..0206bf6 100644
--- a/libbe/rcs.py
+++ b/libbe/rcs.py
@@ -214,6 +214,16 @@ class RCS(object):
changes to commit.
"""
return None
+ def _rcs_revision_id(self, index):
+ """
+ Return the name of the <index>th revision. Index will be an
+ integer (possibly <= 0). The choice of which branch to follow
+ when crossing branches/merges is not defined.
+
+ Return None if revision IDs are not supported, or if the
+ specified revision does not exist.
+ """
+ return None
def installed(self):
try:
self._rcs_help()
@@ -415,6 +425,18 @@ class RCS(object):
Only executed after successful commits.
"""
pass
+ def revision_id(self, index=None):
+ """
+ Return the name of the <index>th revision. The choice of
+ which branch to follow when crossing branches/merges is not
+ defined.
+
+ Return None if index==None, revision IDs are not supported, or
+ if the specified revision does not exist.
+ """
+ if index == None:
+ return None
+ return self._rcs_revision_id(index)
def _u_any_in_string(self, list, string):
"""
Return True if any of the strings in list are in string.
@@ -822,6 +844,39 @@ class RCS_commit_TestCase(RCSTestCase):
self.failUnlessEqual(
self.test_contents['rev_1'], committed_contents)
+ def test_revision_id_as_committed(self):
+ """Check for compatibility between .commit() and .revision_id()"""
+ if not self.rcs.versioned:
+ self.failUnlessEqual(self.rcs.revision_id(5), None)
+ return
+ committed_revisions = []
+ for path in self.test_files:
+ full_path = self.full_path(path)
+ self.rcs.set_file_contents(
+ full_path, self.test_contents['rev_1'])
+ revision = self.rcs.commit("Initial %s contents." % path)
+ committed_revisions.append(revision)
+ self.rcs.set_file_contents(
+ full_path, self.test_contents['uncommitted'])
+ revision = self.rcs.commit("Altered %s contents." % path)
+ committed_revisions.append(revision)
+ for i,revision in enumerate(committed_revisions):
+ self.failUnlessEqual(self.rcs.revision_id(i), revision)
+ i += -len(committed_revisions) # check negative indices
+ self.failUnlessEqual(self.rcs.revision_id(i), revision)
+ i = len(committed_revisions)
+ 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."""