changeset 432:4bf90f8c9b7b

consolidate metadata calls from stupid and replay code
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Mon, 15 Jun 2009 16:10:24 +0200
parents 612b8d753549
children a2a15fa7afb1
files hgsubversion/cmdutil.py hgsubversion/editor.py hgsubversion/stupid.py hgsubversion/wrappers.py
diffstat 4 files changed, 12 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- 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):
--- 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
--- 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
--- 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