Rev 1520: Move functionality for reporting inventory contents to a reporter to a separate function. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Sat Aug 2 16:05:05 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/trunk

------------------------------------------------------------
revno: 1520
revision-id: jelmer at samba.org-20080802150504-djy29xzukeu0pxnd
parent: jelmer at samba.org-20080802145253-yifiv4jwoufx4npx
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sat 2008-08-02 17:05:04 +0200
message:
  Move functionality for reporting inventory contents to a reporter to a separate function.
modified:
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
=== modified file 'fetch.py'
--- a/fetch.py	2008-08-02 14:52:53 +0000
+++ b/fetch.py	2008-08-02 15:05:04 +0000
@@ -475,6 +475,20 @@
     return WeaveRevisionBuildEditor
 
 
+def report_inventory_contents(reporter, inv, revnum, start_empty):
+    try:
+        reporter.set_path("", revnum, start_empty)
+
+        # Report status of existing paths
+        for path, entry in inv.iter_entries():
+            if path != "":
+                reporter.set_path(path.encode("utf-8"), revnum, start_empty)
+    except:
+        reporter.abort()
+        raise
+    reporter.finish()
+
+
 class InterFromSvnRepository(InterRepository):
     """Svn to any repository actions."""
 
@@ -642,19 +656,7 @@
                         else:
                             reporter = conn.do_update(editor.revnum, "", True, editor)
 
-                        try:
-                            # Report status of existing paths
-                            reporter.set_path("", parent_revnum, start_empty)
-
-                            for entry in parent_inv:
-                                path = parent_inv.id2path(entry)
-                                if len(path) > 1:
-                                    reporter.set_path(path, parent_revnum, start_empty)
-                        except:
-                            reporter.abort()
-                            raise
-
-                        reporter.finish()
+                        report_inventory_contents(reporter, parent_inv, parent_revnum, start_empty)
                     finally:
                         if conn is not None:
                             if not conn.busy:




More information about the bazaar-commits mailing list