From 3e50ae9f6c2f60e21695778958018154ec543192 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 12 Nov 2010 15:10:39 -0500 Subject: [PATCH] Improved tag and branch resolution - handles forwards. --- rcs-fast-import | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/rcs-fast-import b/rcs-fast-import index 4f7668c..396c2c1 100755 --- a/rcs-fast-import +++ b/rcs-fast-import @@ -212,6 +212,7 @@ class Commit: self.fileops = [] # blob and file operation list self.properties = {} # commit properties (extension) self.taglist = [] # Tags that point at this commit + self.branchlist = [] # Branches that point at this commit def children(self): "Get a list of this commit's children." return filter(lambda e:self.mark in e.parent_marks,self.repo.commits()) @@ -493,15 +494,31 @@ class Repository: dp = read_data(cStringIO.StringIO()) 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. self.events.append(line) self.import_line = 0 self.readtime = time.time() + # Resolve tags and branches + for event in self.events: + if isinstance(event, Tag): + for commit in self.commits(): + if commit.mark == event.committish: + commit.taglist.append(tag) + break + else: + raise FatalException("tag points at nonexistent %s" + % event.committish) + elif isinstance(event, Reset) and event.committish is not None: + for commit in self.commits(): + if commit.mark == event.committish: + commit.branchlist.append(tag) + break + else: + raise FatalException("reset points at nonexistent %s" + % event.committish) + except KeyboardInterrupt: nuke(self.subdir(), "rcs-fast-import: import interrupted, removing %s" % self.subdir()) raise KeyboardInterrupt -- 2.43.0