Rev 3053: (bug #172970) Change Branch.pull to need to generate_history less often. in http://bzr.arbash-meinel.com/branches/bzr/0.93-dev/pull_set_last_revision_info_172970

John Arbash Meinel john at arbash-meinel.com
Fri Nov 30 04:55:06 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.93-dev/pull_set_last_revision_info_172970

------------------------------------------------------------
revno: 3053
revision-id:john at arbash-meinel.com-20071130045443-11kpm1ka40aix3mh
parent: pqm at pqm.ubuntu.com-20071129184101-u9506rihe4zbzyyz
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: pull_set_last_revision_info_172970
timestamp: Thu 2007-11-29 22:54:43 -0600
message:
  (bug #172970) Change Branch.pull to need to generate_history less often.
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
-------------- next part --------------
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2007-11-16 01:35:31 +0000
+++ b/bzrlib/branch.py	2007-11-30 04:54:43 +0000
@@ -1443,9 +1443,10 @@
         """See Branch.update_revisions."""
         other.lock_read()
         try:
+            other_last_revno, other_last_revision = other.last_revision_info()
             if stop_revision is None:
-                stop_revision = other.last_revision()
-                if stop_revision is None:
+                stop_revision = other_last_revision
+                if _mod_revision.is_null(stop_revision):
                     # if there are no commits, we're done.
                     return
             # whats the current last revision, before we fetch [and change it
@@ -1459,8 +1460,14 @@
             if self.repository.get_graph().is_ancestor(stop_revision,
                                                        last_rev):
                 return
-            self.generate_revision_history(stop_revision, last_rev=last_rev,
-                other_branch=other)
+            if other_last_revision == stop_revision:
+                self.set_last_revision_info(other_last_revno,
+                                            other_last_revision)
+            else:
+                # TODO: jam 2007-11-29 Is there a way to determine the
+                #       revno without searching all of history??
+                self.generate_revision_history(stop_revision, last_rev=last_rev,
+                    other_branch=other)
         finally:
             other.unlock()
 
@@ -1491,9 +1498,13 @@
                 if not overwrite:
                     raise
             if overwrite:
-                if stop_revision is None:
-                    stop_revision = source.last_revision()
-                self.generate_revision_history(stop_revision)
+                last_revno, last_revision = source.last_revision_info()
+                if stop_revision is None or stop_revision == last_revision:
+                    self.set_last_revision_info(last_revno, last_revision)
+                else:
+                    # TODO: jam 2007-11-29 Is there a way to determine the
+                    #       revno without searching all of history??
+                    self.generate_revision_history(stop_revision)
             result.tag_conflicts = source.tags.merge_to(self.tags, overwrite)
             result.new_revno, result.new_revid = self.last_revision_info()
             if _hook_master:



More information about the bazaar-commits mailing list