# HG changeset patch # User Dirkjan Ochtman # Date 1245075024 -7200 # Node ID 4bf90f8c9b7b8a1c856c053dc7f07fef87bc4981 # Parent 612b8d7535495342e9b885c8a93a3dc263f8c6e0 consolidate metadata calls from stupid and replay code diff --git a/hgsubversion/cmdutil.py b/hgsubversion/cmdutil.py --- a/hgsubversion/cmdutil.py +++ b/hgsubversion/cmdutil.py @@ -86,7 +86,7 @@ def replay_convert_rev(ui, meta, svn, r, hg_editor.set_file(p, data, 'x' in mode, 'l' in mode) hg_editor.current.missing = set() meta.ui.note('\n') - hg_editor.commit_current_delta(tbdelta) + return hg_editor.commit_current_delta(tbdelta) def _isdir(svn, branchpath, svndir): diff --git a/hgsubversion/editor.py b/hgsubversion/editor.py --- a/hgsubversion/editor.py +++ b/hgsubversion/editor.py @@ -249,18 +249,9 @@ class HgEditor(delta.Editor): if (rev.revnum, branch) not in self.meta.revmap: self.meta.revmap[rev.revnum, branch] = new_hash - # 3. handle tags - if tbdelta['tags'][0] or tbdelta['tags'][1]: - self.meta.committags(tbdelta['tags'], rev, closebranches) - - # 4. close any branches that need it - for branch, parent in closebranches.iteritems(): - if parent is None: - continue - self.meta.delbranch(branch, parent, rev) - self.current.clear() - + return closebranches + # Here come all the actual editor methods @ieditor diff --git a/hgsubversion/stupid.py b/hgsubversion/stupid.py --- a/hgsubversion/stupid.py +++ b/hgsubversion/stupid.py @@ -628,10 +628,4 @@ def convert_rev(ui, meta, svn, r, tbdelt if closed is not None: deleted_branches[branch] = closed - if tbdelta['tags'][0] or tbdelta['tags'][1]: - meta.committags(tbdelta['tags'], r, deleted_branches) - - for b, parent in deleted_branches.iteritems(): - if parent == node.nullid: - continue - meta.delbranch(b, parent, r) + return deleted_branches diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py --- a/hgsubversion/wrappers.py +++ b/hgsubversion/wrappers.py @@ -266,7 +266,14 @@ def pull(repo, source, heads=[], force=F bits = (r.revnum, r.author, msg) ui.status(('[r%d] %s: %s\n' % bits)[:w]) - pullfuns[have_replay](ui, meta, svn, r, tbdelta) + close = pullfuns[have_replay](ui, meta, svn, r, tbdelta) + if tbdelta['tags'][0] or tbdelta['tags'][1]: + meta.committags(tbdelta['tags'], r, close) + for branch, parent in close.iteritems(): + if parent in (None, node.nullid): + continue + meta.delbranch(branch, parent, r) + meta.save() converted = True