Rev 2677: Merge John's get_revision_graph improvements. in http://people.ubuntu.com/~robertc/baz2.0/repository

Robert Collins robertc at robertcollins.net
Thu Jul 26 05:18:10 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/repository

------------------------------------------------------------
revno: 2677
revision-id: robertc at robertcollins.net-20070726041805-k4ysxvqab6mrxyt9
parent: robertc at robertcollins.net-20070726032631-93j77vekoef09uoi
parent: john at arbash-meinel.com-20070725212922-a72okcvs6nahrz5t
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Thu 2007-07-26 14:18:05 +1000
message:
  Merge John's get_revision_graph improvements.
added:
  doc/conflicts.txt              conflicts.txt-20070723221841-ns3jvwxdb4okn6fk-1
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
  bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
  doc/index.txt                  index.txt-20060622101119-tgwtdci8z769bjb9-2
    ------------------------------------------------------------
    revno: 2592.1.25.2.7.1.30
    revision-id: john at arbash-meinel.com-20070725212922-a72okcvs6nahrz5t
    parent: john at arbash-meinel.com-20070725212630-31m6ichxpr1f8mlk
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: remove_get_revision_graph_redundancy
    timestamp: Wed 2007-07-25 16:29:22 -0500
    message:
      NEWS entry for both fixes
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 2592.1.25.2.7.1.29
    revision-id: john at arbash-meinel.com-20070725212630-31m6ichxpr1f8mlk
    parent: pqm at pqm.ubuntu.com-20070725140043-22lenkarm0oc3tvx
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: remove_get_revision_graph_redundancy
    timestamp: Wed 2007-07-25 16:26:30 -0500
    message:
      Avoid set.difference_update(other) because it is slow when other is big.
      Also, use a_weave.get_graph() rather than re-implementing it in
      knitrepo.py. Further, don't call get_graph() if you aren't going to use it.
    modified:
      bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
    ------------------------------------------------------------
    revno: 2592.1.25.2.7.1.28
    revision-id: pqm at pqm.ubuntu.com-20070725140043-22lenkarm0oc3tvx
    parent: pqm at pqm.ubuntu.com-20070725024725-x592w4y7gdqxv81x
    parent: abentley at panoramicfeedback.com-20070725130409-7r2tfpn3y01ct18h
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Wed 2007-07-25 15:00:43 +0100
    message:
      Remove some quotation marks
    added:
      doc/conflicts.txt              conflicts.txt-20070723221841-ns3jvwxdb4okn6fk-1
    modified:
      doc/index.txt                  index.txt-20060622101119-tgwtdci8z769bjb9-2
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.64
    revision-id: abentley at panoramicfeedback.com-20070725130409-7r2tfpn3y01ct18h
    parent: abentley at panoramicfeedback.com-20070725124509-pgkh53hu4lzleaby
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Wed 2007-07-25 09:04:09 -0400
    message:
      Remove some quotation marks
    modified:
      doc/conflicts.txt              conflicts.txt-20070723221841-ns3jvwxdb4okn6fk-1
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.63
    revision-id: abentley at panoramicfeedback.com-20070725124509-pgkh53hu4lzleaby
    parent: abentley at panoramicfeedback.com-20070724212455-g5lfvmfrulnzu0ki
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Wed 2007-07-25 08:45:09 -0400
    message:
      Update resolution details for parent conflicts
    modified:
      doc/conflicts.txt              conflicts.txt-20070723221841-ns3jvwxdb4okn6fk-1
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.62
    revision-id: abentley at panoramicfeedback.com-20070724212455-g5lfvmfrulnzu0ki
    parent: abentley at panoramicfeedback.com-20070723224115-1flrwqknibtixxi0
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Tue 2007-07-24 17:24:55 -0400
    message:
      Update from review
    modified:
      doc/conflicts.txt              conflicts.txt-20070723221841-ns3jvwxdb4okn6fk-1
      doc/index.txt                  index.txt-20060622101119-tgwtdci8z769bjb9-2
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.61
    revision-id: abentley at panoramicfeedback.com-20070723224115-1flrwqknibtixxi0
    parent: abentley at panoramicfeedback.com-20070723193715-2xkkwmr4l3bfb650
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Mon 2007-07-23 18:41:15 -0400
    message:
      Add conflicts handling description
    added:
      doc/conflicts.txt              conflicts.txt-20070723221841-ns3jvwxdb4okn6fk-1
    modified:
      doc/index.txt                  index.txt-20060622101119-tgwtdci8z769bjb9-2
=== added file 'doc/conflicts.txt'
--- a/doc/conflicts.txt	1970-01-01 00:00:00 +0000
+++ b/doc/conflicts.txt	2007-07-25 13:04:09 +0000
@@ -0,0 +1,174 @@
+=================
+Conflict handling
+=================
+
+Some operations, like merge, revert and pull, modify the contents of your
+working tree.  These modifications are programmatically generated, and so they
+may conflict with the current state of your working tree. Many kinds of changes
+can be combined programmatically, but sometimes only a human can determine the
+right thing to do.  When this happens Bazaar will inform you that there is a
+conflict and then ask you to resolve it.  The command to tell Bazaar a conflict
+is resolved is ``resolve``, but you must perform some action before you can do
+this.
+
+Each type of conflict is explained below, and the action which must be done to
+resolve the conflict is outlined.
+
+
+Text conflicts
+==============
+Typical message::
+
+  Text conflict in FILE
+
+These are produced when a text merge cannot completely reconcile two sets of
+text changes.  Bazaar will emit files for each version with the extensions
+THIS, OTHER, and BASE.  THIS is the version of the file from the target tree,
+i.e. the tree that you are merging changes into.  OTHER is the version that you
+are merging into the target.  BASE is an older version that is used as a basis
+for comparison.
+
+In the main copy of the file, Bazaar will include all the changes that it
+could reconcile, and any un-reconciled conflicts are surrounded by
+"herringbone" markers like ``<<<<<<<``.
+
+Say the initial text is "The project leader released it.", and THIS modifies it
+to "Martin Pool released it.", while OTHER modifies it to "The project leader
+released Bazaar."  A conflict would look like this::
+
+  <<<<<<< TREE
+  Martin Pool released it.
+  =======
+  The project leader released Bazaar.
+  >>>>>>> MERGE-SOURCE
+
+The correct resolution would be "Martin Pool released Bazaar."
+
+You can handle text conflicts either by editing the main copy of the file, or
+by invoking external tools on the THIS, OTHER and BASE versions.  It's worth
+mentioning that resolving text conflicts rarely involves picking one set of
+changes over the other.  More often, the two sets of changes must be
+intelligently combined.
+
+If you edit the main copy, be sure to remove the herringbone markers.  When
+you are done editing, the file should look like it never had a conflict, and be
+ready to commit.
+
+When you have resolved text conflicts, just run "bzr resolve", and Bazaar will
+auto-detect which conflicts you have resolved.
+
+Content conflicts
+=================
+Typical message::
+
+  Contents conflict in FILE
+
+This conflict happens when there are conflicting changes in the target tree and
+the merge source, but the conflicted items are not text files.  They may be
+binary files, or symlinks, or directories.  It can even happen with files that
+are deleted on one side, and modified on the other.
+
+Like text conflicts, Bazaar will emit THIS, OTHER and BASE files.  (They may be
+regular files, symlinks or directories).  But it will not include a "main copy"
+of the file with herringbone conflict markers.  It will appear that the "main
+copy" has been renamed to THIS or OTHER.
+
+To resolve this, use "bzr mv" to rename the file back to its normal name, and
+combine the changes manually.  When you are satisfied, run "bzr resolve
+FILE".  Bazaar cannot auto-detect when conflicts of this kind have been
+resolved.
+
+Duplicate Paths
+===============
+Typical message::
+
+  Conflict adding file FILE.  Moved existing file to FILE.moved.
+
+Sometimes Bazaar will attempt to create a file using a pathname that has
+already been used.  The existing file will be renamed to "FILE.moved".  If
+you wish, you can rename either one of these files, or combine their contents.
+When you are satisfied, you can run "bzr resolve FILE" to mark the conflict as
+resolved.
+
+Unversioned Parent
+==================
+Typical message::
+
+    Conflict because FILE is not versioned, but has versioned children.
+
+Sometimes Bazaar will attempt to create a file whose parent directory is not
+versioned.  This happens when the directory has been deleted in the target,
+but has a new child in the source, or vice versa.  In this situation, Bazaar
+will version the parent directory as well.  Resolving this issue depends
+very much on the particular scenario.  You may wish to rename or delete either
+the file or the directory.  When you are satisfied, you can run "bzr resolve
+FILE" to mark the conflict as resolved.
+
+Missing Parent
+==============
+Typical message::
+
+  Conflict adding files to FILE.  Created directory.
+
+This happens when a file has been deleted in the target, but has new children
+in the source.  This is similar to the "unversioned parent" conflict, except
+that the parent directory does not *exist*, instead of just being unversioned.
+In this situation, Bazaar will create the missing parent.  Resolving this issue
+depends very much on the particular scenario.  You may wish to rename or delete
+either the file or the directory.  When you are satisfied, you can run "bzr
+resolve FILE" to mark the conflict as resolved.
+
+Deleting Parent
+===============
+Typical message::
+
+  Conflict: can't delete FILE because it is not empty.  Not deleting.
+
+This is the opposite of "missing parent".  A directory is deleted in the
+source, but has new children in the target.  Bazaar will retain the directory.
+Resolving this issue depends very much on the particular scenario.  You may
+wish to rename or delete either the file or the directory.  When you are
+satisfied, you can run "bzr resolve FILE" to mark the conflict as resolved.
+
+Path Conflict
+=============
+Typical message::
+
+  Path conflict: PATH1 / PATH2
+
+This happens when the source and target have each modified the name or parent
+directory of a file.  Bazaar will use the path elements from the source.  You
+can rename the file, and once you have, run "bzr resolve FILE" to mark the
+conflict as resolved.
+
+Parent Loop
+===========
+Typical message::
+
+  Conflict moving FILE into DIRECTORY.  Cancelled move.
+
+This happens when the source and the target have each moved directories, so
+that, if the change could be applied, a directory would be contained by itself.
+For example::
+
+  $ bzr init
+  $ bzr mkdir a
+  $ bzr mkdir b
+  $ bzr commit -m "BASE"
+  $ bzr branch . ../other
+  $ bzr mv a b
+  $ bzr commit -m "THIS"
+  $ bzr mv ../other/b ../other/a
+  $ bzr commit ../other -m "OTHER"
+  $ bzr merge ../other
+
+In this situation, Bazaar will cancel the move, and leave "a" in "b".
+You can rename the directories if you like, and once you have, run "bzr resolve
+FILE" to mark the conflict as resolved.
+
+MalformedTransform
+==================
+It is possible (though very rare) for Bazaar to raise a MalformedTransform
+exception.  This means that Bazaar encounted a filesystem conflict that it was
+unable to resolve.  This usually indicates a bug.  Please let us know if you
+encounter this.  Our bug tracker is at https://launchpad.net/bzr/+bugs

=== modified file 'NEWS'
--- a/NEWS	2007-07-26 03:26:31 +0000
+++ b/NEWS	2007-07-26 04:18:05 +0000
@@ -83,6 +83,15 @@
     * Commit now only shows the progress in terms of directories instead of
       entries. (Ian Clatworthy)
 
+    * Fix ``KnitRepository.get_revision_graph`` to not request the graph 2
+      times. This makes ``get_revision_graph`` 2x faster. (John Arbash
+      Meinel)
+
+    * Fix ``VersionedFile.get_graph()`` to avoid using
+      ``set.difference_update(other)``, which has bad scaling when
+      ``other`` is large. This improves ``VF.get_graph([version_id])`` for
+      a 12.5k graph from 2.9s down to 200ms. (John Arbash Meinel)
+
   LIBRARY API BREAKS:
 
     * Deprecated dictionary ``bzrlib.option.SHORT_OPTIONS`` removed.

=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2007-07-26 03:26:31 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2007-07-26 04:18:05 +0000
@@ -161,6 +161,7 @@
         if revision_id not in a_weave:
             raise errors.NoSuchRevision(self, revision_id)
         else:
+            # add what can be reached from revision_id
             return a_weave.get_graph([revision_id])
 
     @needs_read_lock

=== modified file 'bzrlib/versionedfile.py'
--- a/bzrlib/versionedfile.py	2007-07-26 03:26:31 +0000
+++ b/bzrlib/versionedfile.py	2007-07-26 04:18:05 +0000
@@ -399,8 +399,10 @@
             pending = set()
             for version, parents in self.iter_parents(this_iteration):
                 result[version] = parents
-                pending.update(parents)
-            pending.difference_update(result)
+                for parent in parents:
+                    if parent in result:
+                        continue
+                    pending.add(parent)
         return result
 
     def get_graph_with_ghosts(self):

=== modified file 'doc/index.txt'
--- a/doc/index.txt	2007-05-08 04:14:01 +0000
+++ b/doc/index.txt	2007-07-24 21:24:55 +0000
@@ -27,6 +27,10 @@
     The various ways that exist to tell Bazaar your email address for
     commits.
 
+* `Conflict handling <conflicts.htm>`_
+
+    The various kind of conflicts you may encounter, and how to handle them.
+
 * `Plugins <plugins.htm>`_
   (wiki page: http://bazaar-vcs.org/BzrPlugins)
     



More information about the bazaar-commits mailing list