Rev 1333: Simplify fetch code. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4

Jelmer Vernooij jelmer at samba.org
Tue Jun 24 02:31:36 BST 2008


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

------------------------------------------------------------
revno: 1333
revision-id: jelmer at samba.org-20080624013135-bb01g3o08o278iz7
parent: jelmer at samba.org-20080624011046-dsn3oteqnc8ed7do
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2008-06-24 03:31:35 +0200
message:
  Simplify fetch code.
modified:
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
=== modified file 'fetch.py'
--- a/fetch.py	2008-06-22 07:37:15 +0000
+++ b/fetch.py	2008-06-24 01:31:35 +0000
@@ -643,41 +643,33 @@
 
                 editor.start_revision(revid, parent_inv, revmeta)
 
+                if parent_revid == NULL_REVISION:
+                    parent_branch = editor.branch_path
+                    parent_revnum = editor.revnum
+                    start_empty = True
+                else:
+                    (parent_branch, parent_revnum, mapping) = \
+                            self.source.lookup_revision_id(parent_revid)
+                    start_empty = False
+
                 try:
                     conn = None
                     try:
-                        if parent_revid == NULL_REVISION:
-                            branch_url = urlutils.join(repos_root, 
-                                                       editor.branch_path)
-
-                            conn = self.source.transport.connections.get(branch_url)
-                            reporter = conn.do_update(editor.revnum, "", True, 
-                                                           editor)
-
-                            try:
-                                # Report status of existing paths
-                                reporter.set_path("", editor.revnum, True, None)
-                            except:
-                                reporter.abort()
-                                raise
+                        conn = self.source.transport.connections.get(urlutils.join(repos_root, parent_branch))
+
+                        if parent_branch != editor.branch_path:
+                            reporter = conn.do_switch(editor.revnum, "", True, 
+                                urlutils.join(repos_root, editor.branch_path), 
+                                editor)
                         else:
-                            (parent_branch, parent_revnum, mapping) = \
-                                    self.source.lookup_revision_id(parent_revid)
-                            conn = self.source.transport.connections.get(urlutils.join(repos_root, parent_branch))
-
-                            if parent_branch != editor.branch_path:
-                                reporter = conn.do_switch(editor.revnum, "", True, 
-                                    urlutils.join(repos_root, editor.branch_path), 
-                                    editor)
-                            else:
-                                reporter = conn.do_update(editor.revnum, "", True, editor)
-
-                            try:
-                                # Report status of existing paths
-                                reporter.set_path("", parent_revnum, False, None)
-                            except:
-                                reporter.abort()
-                                raise
+                            reporter = conn.do_update(editor.revnum, "", True, editor)
+
+                        try:
+                            # Report status of existing paths
+                            reporter.set_path("", parent_revnum, start_empty)
+                        except:
+                            reporter.abort()
+                            raise
 
                         reporter.finish()
                     finally:




More information about the bazaar-commits mailing list