Rev 3464: merge bzr.dev, resolve NEWS in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/revno_no_history

John Arbash Meinel john at arbash-meinel.com
Fri May 30 22:44:51 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/revno_no_history

------------------------------------------------------------
revno: 3464
revision-id: john at arbash-meinel.com-20080530214430-nbo0wxzbid6z22ml
parent: john at arbash-meinel.com-20080530134519-mpgetc0aho9c60z5
parent: pqm at pqm.ubuntu.com-20080530080302-j1jh2bwxmpd0jn2q
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: revno_no_history
timestamp: Fri 2008-05-30 16:44:30 -0500
message:
  merge bzr.dev, resolve NEWS
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
  bzrlib/uncommit.py             uncommit.py-20050626215513-5ec509fa425b305c
  doc/en/user-guide/branching_a_project.txt branching_a_project.-20071122141511-0knao2lklsdsvb1q-2
    ------------------------------------------------------------
    revno: 3460.1.2
    revision-id: pqm at pqm.ubuntu.com-20080530080302-j1jh2bwxmpd0jn2q
    parent: pqm at pqm.ubuntu.com-20080530010236-e3x7ckdc25s57pgc
    parent: ian.clatworthy at canonical.com-20080530073812-484yybd261n68swp
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Fri 2008-05-30 09:03:02 +0100
    message:
      branch command tweaks in the User Guide (James Westby)
    modified:
      doc/en/user-guide/branching_a_project.txt branching_a_project.-20071122141511-0knao2lklsdsvb1q-2
        ------------------------------------------------------------
        revno: 3460.2.1
        revision-id: ian.clatworthy at canonical.com-20080530073812-484yybd261n68swp
        parent: pqm at pqm.ubuntu.com-20080530010236-e3x7ckdc25s57pgc
        parent: jw+debian at jameswestby.net-20080529184207-uc3pio5g6g9rh6ls
        committer: Ian Clatworthy <ian.clatworthy at canonical.com>
        branch nick: ianc-integration
        timestamp: Fri 2008-05-30 17:38:12 +1000
        message:
          branch command tweaks in the User Guide (James Westby)
        modified:
          doc/en/user-guide/branching_a_project.txt branching_a_project.-20071122141511-0knao2lklsdsvb1q-2
        ------------------------------------------------------------
        revno: 3427.6.2
        revision-id: jw+debian at jameswestby.net-20080529184207-uc3pio5g6g9rh6ls
        parent: jw+debian at jameswestby.net-20080515192315-o80ags1fv0nh2w61
        committer: James Westby <jw+debian at jameswestby.net>
        branch nick: bzr.dev.doc
        timestamp: Thu 2008-05-29 19:42:07 +0100
        message:
          Refer to a "drive qualified path" as suggested by Aaron.
        modified:
          doc/en/user-guide/branching_a_project.txt branching_a_project.-20071122141511-0knao2lklsdsvb1q-2
        ------------------------------------------------------------
        revno: 3427.6.1
        revision-id: jw+debian at jameswestby.net-20080515192315-o80ags1fv0nh2w61
        parent: pqm at pqm.ubuntu.com-20080512115743-6uz3lnmrrbhmoiqe
        committer: James Westby <jw+debian at jameswestby.net>
        branch nick: bzr.dev
        timestamp: Thu 2008-05-15 20:23:15 +0100
        message:
          Small tweaks to the "branch" command documentation in the user guide.
        modified:
          doc/en/user-guide/branching_a_project.txt branching_a_project.-20071122141511-0knao2lklsdsvb1q-2
    ------------------------------------------------------------
    revno: 3460.1.1
    revision-id: pqm at pqm.ubuntu.com-20080530010236-e3x7ckdc25s57pgc
    parent: pqm at pqm.ubuntu.com-20080529210000-bycgfufmrqq63tki
    parent: john at arbash-meinel.com-20080530003519-gh9y3o4r6fd3axo7
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Fri 2008-05-30 02:02:36 +0100
    message:
      (jam) Speed up 'bzr uncommit' by avoiding loading the whole revision
      	history (bug #172649)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/uncommit.py             uncommit.py-20050626215513-5ec509fa425b305c
    ------------------------------------------------------------
    revno: 3449.2.8
    revision-id: john at arbash-meinel.com-20080530003519-gh9y3o4r6fd3axo7
    parent: john at arbash-meinel.com-20080530002233-j4hl3lguy8whedbx
    parent: pqm at pqm.ubuntu.com-20080529210000-bycgfufmrqq63tki
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: uncommit_perf
    timestamp: Thu 2008-05-29 19:35:19 -0500
    message:
      merge bzr.dev, resolve NEWS
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
      bzrlib/symbol_versioning.py    symbol_versioning.py-20060105104851-9ecf8af605d15a80
      bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
      bzrlib/tests/branch_implementations/test_update.py test_update.py-20060305010612-e68efbcbb1baa69f
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
      bzrlib/tests/test_merge_core.py test_merge_core.py-20050824132511-eb99b23a0eec641b
      bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
      bzrlib/tests/test_symbol_versioning.py test_symbol_versioning.py-20060105104851-51d7722c2018d42b
      bzrlib/transport/fakenfs.py    fakenfs.py-20060402223312-0e29c7275aa384dd
      doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
      doc/developers/index.txt       index.txt-20070508041241-qznziunkg0nffhiw-1
      doc/developers/releasing.txt   releasing.txt-20080502015919-fnrcav8fwy8ccibu-1
      doc/en/user-guide/partner_intro.txt partner_workflow.txt-20071122141511-0knao2lklsdsvb1q-4
      doc/en/user-guide/releasing_a_project.txt releasing_a_project.-20071121073725-0corxykv5irjal00-5
      doc/en/user-guide/svn_plugin.txt svn_plugin.txt-20080509065016-cjc90f46407vi9a0-2
      doc/en/user-guide/undoing_mistakes.txt undoing_mistakes.txt-20071121092300-8fyacngt1w98e5mp-1
    ------------------------------------------------------------
    revno: 3449.2.7
    revision-id: john at arbash-meinel.com-20080530002233-j4hl3lguy8whedbx
    parent: john at arbash-meinel.com-20080529225649-jrt6bxq9kdur056m
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: uncommit_perf
    timestamp: Thu 2008-05-29 19:22:33 -0500
    message:
      Minor tweak from Ian
    modified:
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
    ------------------------------------------------------------
    revno: 3449.2.6
    revision-id: john at arbash-meinel.com-20080529225649-jrt6bxq9kdur056m
    parent: john at arbash-meinel.com-20080529225052-vfuu4xtkcnntplgx
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: uncommit_perf
    timestamp: Thu 2008-05-29 17:56:49 -0500
    message:
      Update news with performance numbers
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3449.2.5
    revision-id: john at arbash-meinel.com-20080529225052-vfuu4xtkcnntplgx
    parent: john at arbash-meinel.com-20080529221528-2shky6po8ki0hq25
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: uncommit_perf
    timestamp: Thu 2008-05-29 17:50:52 -0500
    message:
      Stop referencing the variable I removed.
      len(which_revs) == branch_revno, so we can just use that.
    modified:
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
    ------------------------------------------------------------
    revno: 3449.2.4
    revision-id: john at arbash-meinel.com-20080529221528-2shky6po8ki0hq25
    parent: john at arbash-meinel.com-20080529212402-vqgem865h6w90z9z
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: uncommit_perf
    timestamp: Thu 2008-05-29 17:15:28 -0500
    message:
      properly handle when you uncommit back to NULL_REVISION
    modified:
      bzrlib/uncommit.py             uncommit.py-20050626215513-5ec509fa425b305c
    ------------------------------------------------------------
    revno: 3449.2.3
    revision-id: john at arbash-meinel.com-20080529212402-vqgem865h6w90z9z
    parent: john at arbash-meinel.com-20080523060036-24gdulfvnog38w6v
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: uncommit_perf
    timestamp: Thu 2008-05-29 16:24:02 -0500
    message:
      restore --verbose, and document --local
    modified:
      bzrlib/uncommit.py             uncommit.py-20050626215513-5ec509fa425b305c
    ------------------------------------------------------------
    revno: 3449.2.2
    revision-id: john at arbash-meinel.com-20080523060036-24gdulfvnog38w6v
    parent: john at arbash-meinel.com-20080523053753-frkmeyg4uowpau6f
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: uncommit_perf
    timestamp: Fri 2008-05-23 01:00:36 -0500
    message:
      Fix bug #172649. Cleanup, and handle the case where we are logging to the first revision.
    modified:
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
    ------------------------------------------------------------
    revno: 3449.2.1
    revision-id: john at arbash-meinel.com-20080523053753-frkmeyg4uowpau6f
    parent: pqm at pqm.ubuntu.com-20080522125310-lneifpa40hzg4lu2
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: uncommit_perf
    timestamp: Fri 2008-05-23 00:37:53 -0500
    message:
      bzr uncommit doesn't need to work in terms of 'revision_history()'
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/uncommit.py             uncommit.py-20050626215513-5ec509fa425b305c
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-05-30 13:45:19 +0000
+++ b/NEWS	2008-05-30 21:44:30 +0000
@@ -34,6 +34,11 @@
 
   IMPROVEMENTS:
 
+    * ``bzr branch/push/pull -r XXX`` now have a helper function for finding
+      the revno of the new revision (``Graph.find_distance_to_null``). This
+      should make something like ``bzr branch -r -100`` in a shared, no-trees
+      repository much snappier. (John Arbash Meinel)
+
     * ``bzr log --short -r X..Y`` no longer needs to access the full revision
       history. This makes it noticeably faster when logging the last few
       revisions. (John Arbash Meinel)
@@ -45,10 +50,12 @@
       ``Graph.find_differences`` to determine missing revisions without having
       to search the whole ancestry. (John Arbash Meinel, #174625)
 
-    * ``bzr branch/push/pull -r XXX`` now have a helper function for finding
-      the revno of the new revision (``Graph.find_distance_to_null``). This
-      should make something like ``bzr branch -r -100`` in a shared, no-trees
-      repository much snappier. (John Arbash Meinel)
+    * ``bzr uncommit`` now uses partial history access, rather than always
+      extracting the full revision history for a branch. This makes it
+      resolve the appropriate revisions much faster (in testing it drops
+      uncommit from 1.5s => 0.4s). It also means ``bzr log --short`` is one
+      step closer to not using full revision history.
+      (John Arbash Meinel, #172649)
 
   BUGFIXES:
 

=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py	2008-05-19 18:56:45 +0000
+++ b/bzrlib/log.py	2008-05-30 00:22:33 +0000
@@ -335,8 +335,8 @@
 
     :return: A (mainline_revs, rev_nos, start_rev_id, end_rev_id) tuple.
     """
-    which_revs = _enumerate_history(branch)
-    if not which_revs:
+    branch_revno, branch_last_revision = branch.last_revision_info()
+    if branch_revno == 0:
         return None, None, None, None
 
     # For mainline generation, map start_revision and end_revision to 
@@ -349,7 +349,7 @@
     if start_revision is None:
         start_revno = 1
     else:
-        if isinstance(start_revision,RevisionInfo):
+        if isinstance(start_revision, RevisionInfo):
             start_rev_id = start_revision.rev_id
             start_revno = start_revision.revno or 1
         else:
@@ -358,11 +358,11 @@
     
     end_rev_id = None
     if end_revision is None:
-        end_revno = len(which_revs)
+        end_revno = branch_revno
     else:
-        if isinstance(end_revision,RevisionInfo):
+        if isinstance(end_revision, RevisionInfo):
             end_rev_id = end_revision.rev_id
-            end_revno = end_revision.revno or len(which_revs)
+            end_revno = end_revision.revno or branch_revno
         else:
             branch.check_real_revno(end_revision)
             end_revno = end_revision
@@ -374,20 +374,29 @@
         raise BzrCommandError("Start revision must be older than "
                               "the end revision.")
 
-    # list indexes are 0-based; revisions are 1-based
-    cut_revs = which_revs[(start_revno-1):(end_revno)]
-    if not cut_revs:
+    if end_revno < start_revno:
         return None, None, None, None
+    cur_revno = branch_revno
+    rev_nos = {}
+    mainline_revs = []
+    for revision_id in branch.repository.iter_reverse_revision_history(
+                        branch_last_revision):
+        if cur_revno < start_revno:
+            # We have gone far enough, but we always add 1 more revision
+            rev_nos[revision_id] = cur_revno
+            mainline_revs.append(revision_id)
+            break
+        if cur_revno <= end_revno:
+            rev_nos[revision_id] = cur_revno
+            mainline_revs.append(revision_id)
+        cur_revno -= 1
+    else:
+        # We walked off the edge of all revisions, so we add a 'None' marker
+        mainline_revs.append(None)
 
-    # convert the revision history to a dictionary:
-    rev_nos = dict((k, v) for v, k in cut_revs)
+    mainline_revs.reverse()
 
     # override the mainline to look like the revision history.
-    mainline_revs = [revision_id for index, revision_id in cut_revs]
-    if cut_revs[0][0] == 1:
-        mainline_revs.insert(0, None)
-    else:
-        mainline_revs.insert(0, which_revs[start_revno-2][1])
     return mainline_revs, rev_nos, start_rev_id, end_rev_id
 
 

=== modified file 'bzrlib/uncommit.py'
--- a/bzrlib/uncommit.py	2008-03-20 15:10:05 +0000
+++ b/bzrlib/uncommit.py	2008-05-29 22:15:28 +0000
@@ -35,6 +35,9 @@
     :param dry_run: Don't actually change anything
     :param verbose: Print each step as you do it
     :param revno: Remove back to this revision
+    :param local: If this branch is bound, only remove the revisions from the
+        local branch. If this branch is not bound, it is an error to pass
+        local=True.
     """
     unlockable = []
     try:
@@ -58,35 +61,42 @@
             if master is not None:
                 master.lock_write()
                 unlockable.append(master)
-        rh = branch.revision_history()
-        if master is not None and rh[-1] != master.last_revision():
+        old_revno, old_tip = branch.last_revision_info()
+        if master is not None and old_tip != master.last_revision():
             raise BoundBranchOutOfDate(branch, master)
         if revno is None:
-            revno = len(rh)
-        old_revno, old_tip = branch.last_revision_info()
-        new_revno = revno -1
+            revno = old_revno
+        new_revno = revno - 1
 
-        files_to_remove = []
-        for r in range(revno-1, len(rh)):
-            rev_id = rh.pop()
-            # NB: performance would be better using the revision graph rather
-            # than the whole revision.
-            rev = branch.repository.get_revision(rev_id)
+        revid_iterator = branch.repository.iter_reverse_revision_history(
+                            old_tip)
+        cur_revno = old_revno
+        new_revision_id = old_tip
+        graph = branch.repository.get_graph()
+        for rev_id in revid_iterator:
+            if cur_revno == new_revno:
+                new_revision_id = rev_id
+                break
+            if verbose:
+                print 'Removing revno %d: %s' % (cur_revno, rev_id)
+            cur_revno -= 1
+            parents = graph.get_parent_map([rev_id]).get(rev_id, None)
+            if not parents:
+                continue
             # When we finish popping off the pending merges, we want
             # them to stay in the order that they used to be.
             # but we pop from the end, so reverse the order, and
             # then get the order right at the end
-            pending_merges.extend(reversed(rev.parent_ids[1:]))
-            if verbose:
-                print 'Removing revno %d: %s' % (len(rh)+1, rev_id)
+            pending_merges.extend(reversed(parents[1:]))
+        else:
+            # We ran off the end of revisions, which means we should be trying
+            # to get to NULL_REVISION
+            new_revision_id = _mod_revision.NULL_REVISION
 
-        # Committing before we start removing files, because
-        # once we have removed at least one, all the rest are invalid.
         if not dry_run:
             if master is not None:
-                master.set_revision_history(rh)
-            branch.set_revision_history(rh)
-            new_tip = _mod_revision.ensure_null(branch.last_revision())
+                master.set_last_revision_info(new_revno, new_revision_id)
+            branch.set_last_revision_info(new_revno, new_revision_id)
             if master is None:
                 hook_local = None
                 hook_master = branch
@@ -94,14 +104,14 @@
                 hook_local = branch
                 hook_master = master
             for hook in Branch.hooks['post_uncommit']:
-                hook_new_tip = new_tip
+                hook_new_tip = new_revision_id
                 if hook_new_tip == _mod_revision.NULL_REVISION:
                     hook_new_tip = None
                 hook(hook_local, hook_master, old_revno, old_tip, new_revno,
                      hook_new_tip)
             if tree is not None:
-                if not _mod_revision.is_null(new_tip):
-                    parents = [new_tip]
+                if not _mod_revision.is_null(new_revision_id):
+                    parents = [new_revision_id]
                 else:
                     parents = []
                 parents.extend(reversed(pending_merges))

=== modified file 'doc/en/user-guide/branching_a_project.txt'
--- a/doc/en/user-guide/branching_a_project.txt	2008-02-24 02:55:24 +0000
+++ b/doc/en/user-guide/branching_a_project.txt	2008-05-29 18:42:07 +0000
@@ -48,16 +48,16 @@
 The branch command
 ------------------
 
-To get a copy of an existing branch, use the ``branch`` command.
+To get a branch based on an existing branch, use the ``branch`` command.
 The syntax is::
 
   bzr branch URL [directory]
 
 If a directory is not given, one is created based on the last part of
-the URL. Here are some examples showing a network share URL and an
+the URL. Here are some examples showing a drive qualified path (M:/) and an
 sftp URL respectively::
 
-  bzr branch m:/cool-trunk
+  bzr branch M:/cool-trunk
   bzr branch sftp://bill@mary-laptop/cool-repo/cool-trunk
 
 This example shows explicitly giving the directory name to use for the



More information about the bazaar-commits mailing list