#
# Requires Python 2.5 or newer.
#
-#
# TO DO:
-# * Apply tags
# * Branch structure!
+# * Checkout options
#
"""
Usage: rcs-fast-import [-v] [-u] [-l] [-d] [-n] [-V]
self.branch = None # branch name
self.fileops = [] # blob and file operation list
self.properties = {} # commit properties (extension)
+ self.taglist = [] # Tags that point at this commit
class Passthrough:
"Represents a passthrough line."
if hasattr(e, "mark") and mark == e.mark:
return i
return None
+ def commits(self):
+ "Return a list of the repository commit objects."
+ return filter(lambda e: isinstance(e, Commit), self.events)
def fast_import(self, fp, progress=False):
"Initialize repo object from fast-import stream."
try:
self.warn("missing tagger after from in tag")
pushback(line)
dp = read_data(cStringIO.StringIO())
- self.events.append(Tag(tagname,
- referent, tagger, dp.getvalue()))
+ tag = Tag(tagname, referent, tagger, dp.getvalue())
+ self.events.append(tag)
+ for commit in self.commits():
+ if commit.mark == referent:
+ commit.taglist.append(tag)
baton.twirl()
else:
# Simply pass through any line we don't understand.
parts = list(os.path.split(filename))
parts.insert(-1, "RCS")
return os.path.join(*parts)
+ @staticmethod
+ def rcsfiles():
+ "List all masters."
+ res = []
+ for root, dirs, files in os.walk(os.getcwd(), topdown=False):
+ if root.endswith("/RCS"):
+ for name in files:
+ res.append(os.path.join(root, name))
+ return res
def commit(self, event, committables):
"Perform RCS file checkins and modifications,"
for (path, mode, copyfile) in committables:
announce("removing %s" % (path,))
if not dryrun:
os.remove(path)
+ for tag in event.taglist:
+ do_or_die("rcs -n'%s': %s" % (tag.name, " ".join(RCS.rcsfiles())))
def rename(self, source, target):
"Perform RCS renames."
# Dodgy, but since user is more likely to be