diff options
author | termie <code@term.ie> | 2011-01-30 14:31:03 -0800 |
---|---|---|
committer | termie <code@term.ie> | 2011-01-30 14:31:03 -0800 |
commit | 1efe12dfdf0b360f89ec30ed1f30b749f826bcba (patch) | |
tree | 903dc7a698177a0efb7983ddb383895cdf7f8f6c | |
parent | 76db1c7174544db3223397743d81e9a67802577f (diff) | |
download | bzr-fastimport-1efe12dfdf0b360f89ec30ed1f30b749f826bcba.tar.gz |
Add a bunch of mark id normalization.
bzr-fastimport is getting marks from a variety of sources, all of which
us the format ':\d+' but it really wants just the raw number internally.
This patch cleans up the symptoms of many places where this normalization
was not occuring.
-rw-r--r-- | branch_updater.py | 1 | ||||
-rw-r--r-- | bzr_commit_handler.py | 2 | ||||
-rw-r--r-- | marks_file.py | 5 | ||||
-rw-r--r-- | processors/generic_processor.py | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/branch_updater.py b/branch_updater.py index 039171f..a908f1d 100644 --- a/branch_updater.py +++ b/branch_updater.py @@ -151,6 +151,7 @@ class BranchUpdater(object): :return: whether the branch was changed or not """ from fastimport.helpers import single_plural + last_mark = last_mark.lstrip(':') last_rev_id = self.cache_mgr.revision_ids[last_mark] revs = list(self.repo.iter_reverse_revision_history(last_rev_id)) revno = len(revs) diff --git a/bzr_commit_handler.py b/bzr_commit_handler.py index d81b271..9988f0a 100644 --- a/bzr_commit_handler.py +++ b/bzr_commit_handler.py @@ -113,7 +113,7 @@ class GenericCommitHandler(processor.CommitHandler): # Convert the parent commit-ids to bzr revision-ids if parents: - self.parents = [self.cache_mgr.revision_ids[p] + self.parents = [self.cache_mgr.revision_ids[p.lstrip(':')] for p in parents] else: self.parents = [] diff --git a/marks_file.py b/marks_file.py index c05f8c6..7066a1c 100644 --- a/marks_file.py +++ b/marks_file.py @@ -53,8 +53,7 @@ def import_marks(filename): while line: line = line.rstrip('\n') mark, revid = line.split(' ', 1) - if mark.startswith(':'): - mark = mark[1:] + mark = mark.lstrip(':') revision_ids[mark] = revid line = f.readline() f.close() @@ -76,5 +75,5 @@ def export_marks(filename, revision_ids): # Write the revision info for mark, revid in revision_ids.iteritems(): - f.write(':%s %s\n' % (mark, revid)) + f.write(':%s %s\n' % (str(mark).lstrip(':'), revid)) f.close() diff --git a/processors/generic_processor.py b/processors/generic_processor.py index 093a432..e17a2ff 100644 --- a/processors/generic_processor.py +++ b/processors/generic_processor.py @@ -533,9 +533,9 @@ class GenericProcessor(processor.ImportProcessor): except: print "ABORT: exception occurred processing commit %s" % (cmd.id) raise - self.cache_mgr.revision_ids[cmd.id] = handler.revision_id + self.cache_mgr.revision_ids[cmd.id.lstrip(':')] = handler.revision_id self._revision_count += 1 - self.report_progress("(%s)" % cmd.id) + self.report_progress("(%s)" % cmd.id.lstrip(':')) if cmd.ref.startswith('refs/tags/'): tag_name = cmd.ref[len('refs/tags/'):] |