Rev 2811: Merge bzr.dev. in http://people.ubuntu.com/~robertc/baz2.0/knits

Robert Collins robertc at robertcollins.net
Tue Sep 11 05:18:36 BST 2007


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

------------------------------------------------------------
revno: 2811
revision-id: robertc at robertcollins.net-20070911041823-pn9kn8l5zmmptnsr
parent: robertc at robertcollins.net-20070911040511-g0wxzi6iyr3u379q
parent: pqm at pqm.ubuntu.com-20070911020027-bmt9h0jgy3zdlge3
committer: Robert Collins <robertc at robertcollins.net>
branch nick: knits
timestamp: Tue 2007-09-11 14:18:23 +1000
message:
  Merge bzr.dev.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
  bzrlib/repofmt/weaverepo.py    presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tag.py                  tag.py-20070212110532-91cw79inah2cfozx-1
  bzrlib/tests/test_tag.py       test_tag.py-20070212110532-91cw79inah2cfozx-2
  bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
  doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
    ------------------------------------------------------------
    revno: 2805.1.7
    revision-id: pqm at pqm.ubuntu.com-20070911020027-bmt9h0jgy3zdlge3
    parent: pqm at pqm.ubuntu.com-20070911010353-6lu7ek40rbjhj86o
    parent: robertc at robertcollins.net-20070911002917-53h2vb7ex4xh00u7
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Tue 2007-09-11 03:00:27 +0100
    message:
      (robertc) Use a better api during commit to reduce overhead when adding texts. (Robert Collins)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/repofmt/weaverepo.py    presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
        ------------------------------------------------------------
        revno: 2803.2.2
        revision-id: robertc at robertcollins.net-20070911002917-53h2vb7ex4xh00u7
        parent: robertc at robertcollins.net-20070909220156-wmm9up3q0mzisrb2
        committer: Robert Collins <robertc at robertcollins.net>
        branch nick: commit-builder
        timestamp: Tue 2007-09-11 10:29:17 +1000
        message:
          Add comment for igc.
        modified:
          bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
        ------------------------------------------------------------
        revno: 2803.2.1
        revision-id: robertc at robertcollins.net-20070909220156-wmm9up3q0mzisrb2
        parent: pqm at pqm.ubuntu.com-20070906050530-q58gvki4dedc4i6e
        committer: Robert Collins <robertc at robertcollins.net>
        branch nick: commit-builder
        timestamp: Mon 2007-09-10 08:01:56 +1000
        message:
          * CommitBuilder now advertises itself as requiring the root entry to be
            supplied. This only affects foreign repository implementations which reuse
            CommitBuilder directly and have changed record_entry_contents to require
            that the root not be supplied. This should be precisely zero plugins
            affected. (Robert Collins)
          
          * CommitBuilder now defaults to using add_lines_with_ghosts, reducing
            overhead on non-weave repositories which don't require all parents to be
            present. (Robert Collins)
        modified:
          NEWS                           NEWS-20050323055033-4e00b5db738777ff
          bzrlib/repofmt/weaverepo.py    presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
          bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
    ------------------------------------------------------------
    revno: 2805.1.6
    revision-id: pqm at pqm.ubuntu.com-20070911010353-6lu7ek40rbjhj86o
    parent: pqm at pqm.ubuntu.com-20070910121243-ccy1gej0kqy4feen
    parent: mbp at sourcefrog.net-20070911001556-7lji6zrw4xw9vv1f
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Tue 2007-09-11 02:03:53 +0100
    message:
      (lukas) Overwrite conflicting tags by push|pull --overwrite
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/tag.py                  tag.py-20070212110532-91cw79inah2cfozx-1
      bzrlib/tests/test_tag.py       test_tag.py-20070212110532-91cw79inah2cfozx-2
        ------------------------------------------------------------
        revno: 2805.1.5.1.1
        revision-id: mbp at sourcefrog.net-20070911001556-7lji6zrw4xw9vv1f
        parent: pqm at pqm.ubuntu.com-20070910121243-ccy1gej0kqy4feen
        parent: lalinsky at gmail.com-20070907113713-9xb7l82n81g2amdn
        committer: Martin Pool <mbp at sourcefrog.net>
        branch nick: tag-overwrite
        timestamp: Tue 2007-09-11 10:15:56 +1000
        message:
          merge push|pull --overwrite and tweak
        modified:
          NEWS                           NEWS-20050323055033-4e00b5db738777ff
          bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
          bzrlib/tag.py                  tag.py-20070212110532-91cw79inah2cfozx-1
          bzrlib/tests/test_tag.py       test_tag.py-20070212110532-91cw79inah2cfozx-2
        ------------------------------------------------------------
        revno: 2804.3.1
        revision-id: lalinsky at gmail.com-20070907113713-9xb7l82n81g2amdn
        parent: pqm at pqm.ubuntu.com-20070906063814-iiwx3hccoukt499k
        committer: Lukáš Lalinský <lalinsky at gmail.com>
        branch nick: overwrite-tags
        timestamp: Fri 2007-09-07 13:37:13 +0200
        message:
          Overwrite conflicting tags by push|pull --overwrite.
        modified:
          NEWS                           NEWS-20050323055033-4e00b5db738777ff
          bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
          bzrlib/tag.py                  tag.py-20070212110532-91cw79inah2cfozx-1
          bzrlib/tests/test_tag.py       test_tag.py-20070212110532-91cw79inah2cfozx-2
    ------------------------------------------------------------
    revno: 2805.1.5
    revision-id: pqm at pqm.ubuntu.com-20070910121243-ccy1gej0kqy4feen
    parent: pqm at pqm.ubuntu.com-20070910105743-72rhm2629qiijbsj
    parent: mbp at sourcefrog.net-20070910095545-1wuzua8ly1tdee9o
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2007-09-10 13:12:43 +0100
    message:
      Old fix from Alexander: set_tag_dict should lock the branch
    modified:
      bzrlib/tag.py                  tag.py-20070212110532-91cw79inah2cfozx-1
        ------------------------------------------------------------
        revno: 2805.5.1
        revision-id: mbp at sourcefrog.net-20070910095545-1wuzua8ly1tdee9o
        parent: pqm at pqm.ubuntu.com-20070907145828-hjh5941jv7y8d9z8
        committer: Martin Pool <mbp at sourcefrog.net>
        branch nick: tag-lock
        timestamp: Mon 2007-09-10 19:55:45 +1000
        message:
          Old fix from Alexander: set_tag_dict should lock the branch
        modified:
          bzrlib/tag.py                  tag.py-20070212110532-91cw79inah2cfozx-1
    ------------------------------------------------------------
    revno: 2805.1.4
    revision-id: pqm at pqm.ubuntu.com-20070910105743-72rhm2629qiijbsj
    parent: pqm at pqm.ubuntu.com-20070910100551-cw3iuntfi1kwj8jg
    parent: mbp at sourcefrog.net-20070910092754-v85j56whbxh75acb
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2007-09-10 11:57:43 +0100
    message:
      Transport.ensure_base should ignore PermissionDenied when trying to create the directory (Axel Kollmorgen)
    modified:
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
        ------------------------------------------------------------
        revno: 2805.4.1
        revision-id: mbp at sourcefrog.net-20070910092754-v85j56whbxh75acb
        parent: pqm at pqm.ubuntu.com-20070907145828-hjh5941jv7y8d9z8
        committer: Martin Pool <mbp at sourcefrog.net>
        branch nick: integration
        timestamp: Mon 2007-09-10 19:27:54 +1000
        message:
          Transport.ensure_base should ignore PermissionDenied when trying to create the directory (Axel Kollmorgen)
        modified:
          bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
    ------------------------------------------------------------
    revno: 2805.1.3
    revision-id: pqm at pqm.ubuntu.com-20070910100551-cw3iuntfi1kwj8jg
    parent: pqm at pqm.ubuntu.com-20070910085701-36pk2aye9gf2vc0t
    parent: mbp at sourcefrog.net-20070906012710-fu7nkpp26k72a70n
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2007-09-10 11:05:51 +0100
    message:
      (mbp) coding standard and doc updates
    modified:
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
        ------------------------------------------------------------
        revno: 2795.1.3
        revision-id: mbp at sourcefrog.net-20070906012710-fu7nkpp26k72a70n
        parent: mbp at sourcefrog.net-20070905064242-642im0o3ookdlmqw
        committer: Martin Pool <mbp at sourcefrog.net>
        branch nick: doc
        timestamp: Thu 2007-09-06 11:27:10 +1000
        message:
          clarify spacing for function parameters
        modified:
          doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
        ------------------------------------------------------------
        revno: 2795.1.2
        revision-id: mbp at sourcefrog.net-20070905064242-642im0o3ookdlmqw
        parent: mbp at sourcefrog.net-20070905051221-ubcur9dfodsozr28
        committer: Martin Pool <mbp at sourcefrog.net>
        branch nick: doc
        timestamp: Wed 2007-09-05 16:42:42 +1000
        message:
          emacs indent additions from vila
        modified:
          bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
          doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
        ------------------------------------------------------------
        revno: 2795.1.1
        revision-id: mbp at sourcefrog.net-20070905051221-ubcur9dfodsozr28
        parent: pqm at pqm.ubuntu.com-20070905001648-0iigag4tq1u8mywn
        committer: Martin Pool <mbp at sourcefrog.net>
        branch nick: doc
        timestamp: Wed 2007-09-05 15:12:21 +1000
        message:
          Document code layout stuff
        modified:
          doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
    ------------------------------------------------------------
    revno: 2805.1.2
    revision-id: pqm at pqm.ubuntu.com-20070910085701-36pk2aye9gf2vc0t
    parent: pqm at pqm.ubuntu.com-20070910054843-evbkt0bivtk6tpqu
    parent: ian.clatworthy at internode.on.net-20070910080059-yzwto88w0irifgk6
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2007-09-10 09:57:01 +0100
    message:
      branches and standalone-trees documentation (Ian Clatworthy)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
        ------------------------------------------------------------
        revno: 2805.1.1.1.1
        revision-id: ian.clatworthy at internode.on.net-20070910080059-yzwto88w0irifgk6
        parent: pqm at pqm.ubuntu.com-20070910054843-evbkt0bivtk6tpqu
        parent: ian.clatworthy at internode.on.net-20070907034241-vt2rgf4lqqwjbttm
        committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
        branch nick: ianc-integration
        timestamp: Mon 2007-09-10 18:00:59 +1000
        message:
          branches and standalone-trees documentation (Ian Clatworthy)
        modified:
          NEWS                           NEWS-20050323055033-4e00b5db738777ff
          bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
        ------------------------------------------------------------
        revno: 2804.2.1
        revision-id: ian.clatworthy at internode.on.net-20070907034241-vt2rgf4lqqwjbttm
        parent: pqm at pqm.ubuntu.com-20070906063814-iiwx3hccoukt499k
        committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
        branch nick: bzr.concepts
        timestamp: Fri 2007-09-07 13:42:41 +1000
        message:
          add branches and standalone-trees as help topics
        modified:
          NEWS                           NEWS-20050323055033-4e00b5db738777ff
          bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
    ------------------------------------------------------------
    revno: 2805.1.1
    revision-id: pqm at pqm.ubuntu.com-20070910054843-evbkt0bivtk6tpqu
    parent: pqm at pqm.ubuntu.com-20070907145828-hjh5941jv7y8d9z8
    parent: ian.clatworthy at internode.on.net-20070910050624-9iwn4y6n8b3fyjwn
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2007-09-10 06:48:43 +0100
    message:
      selftest --benchmark verbose again by default (Ian Clatworthy)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
    ------------------------------------------------------------
    revno: 2805.2.1
    revision-id: ian.clatworthy at internode.on.net-20070910050624-9iwn4y6n8b3fyjwn
    parent: pqm at pqm.ubuntu.com-20070907145828-hjh5941jv7y8d9z8
    parent: ian.clatworthy at internode.on.net-20070910021814-fpu0zjjmebnc10tn
    committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
    branch nick: ianc-integration
    timestamp: Mon 2007-09-10 15:06:24 +1000
    message:
      selftest --benchmark verbose again by default (Ian Clatworthy)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
    ------------------------------------------------------------
    revno: 2805.3.1
    revision-id: ian.clatworthy at internode.on.net-20070910021814-fpu0zjjmebnc10tn
    parent: pqm at pqm.ubuntu.com-20070907145828-hjh5941jv7y8d9z8
    committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
    branch nick: bzr.verbose-benchmarks
    timestamp: Mon 2007-09-10 12:18:14 +1000
    message:
      Fix selftest --benchmark so verbose by default again
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
=== modified file 'NEWS'
--- a/NEWS	2007-09-10 03:37:19 +0000
+++ b/NEWS	2007-09-11 04:18:23 +0000
@@ -123,8 +123,11 @@
    * ``bzr --version`` takes care about encoding of stdout, especially
      when output is redirected. (Alexander Belchenko, #131100)
 
-    * Prompt for an ftp password if none is provided.
-      (Vincent Ladeuil, #137044)
+   * Prompt for an ftp password if none is provided.
+     (Vincent Ladeuil, #137044)
+
+   * Overwrite conflicting tags by ``push`` and ``pull`` if the
+     ``--overwrite`` option is specified.  (Lukáš Lalinský, #93947)
 
   IMPROVEMENTS:
 
@@ -176,11 +179,21 @@
    * HACKING has been extended with a large section on core developer tasks.
      (Ian Clatworthy)
 
+   * Add ``branches`` and ``standalone-trees`` as online help topics and
+     include them as Concepts within the User Reference.
+     (Paul Moore, Ian Clatworthy)
+
   API BREAKS:
 
    * ``Branch.append_revision`` is removed altogether; please use 
      ``Branch.set_last_revision_info`` instead.  (Martin Pool)
 
+   * CommitBuilder now advertises itself as requiring the root entry to be
+     supplied. This only affects foreign repository implementations which reuse
+     CommitBuilder directly and have changed record_entry_contents to require
+     that the root not be supplied. This should be precisely zero plugins
+     affected. (Robert Collins)
+
    * The ``add_lines`` methods on ``VersionedFile`` implementations has changed
      its return value to include the sha1 and length of the inserted text. This
      allows the avoidance of double-sha1 calculations during commit.
@@ -226,10 +239,14 @@
      This is done in order to mix the commit messages (which is a unicode
      string), and the diff which is a raw string. (Goffredo Baroncelli)
 
-    * Deprecated method ``find_previous_heads`` on
-      ``bzrlib.inventory.InventoryEntry``. This has been superseded by the use
-      of ``parent_candidates`` and a separate heads check via the repository
-      API. (Robert Collins)
+   * CommitBuilder now defaults to using add_lines_with_ghosts, reducing
+     overhead on non-weave repositories which don't require all parents to be
+     present. (Robert Collins)
+
+   * Deprecated method ``find_previous_heads`` on
+     ``bzrlib.inventory.InventoryEntry``. This has been superseded by the use
+     of ``parent_candidates`` and a separate heads check via the repository
+     API. (Robert Collins)
 
    * New trace function ``mutter_callsite`` will print out a subset of the
      stack to the log, which can be useful for gathering debug details.

=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2007-08-27 08:38:37 +0000
+++ b/bzrlib/branch.py	2007-09-07 11:37:13 +0000
@@ -1485,7 +1485,7 @@
                 if stop_revision is None:
                     stop_revision = source.last_revision()
                 self.generate_revision_history(stop_revision)
-            result.tag_conflicts = source.tags.merge_to(self.tags)
+            result.tag_conflicts = source.tags.merge_to(self.tags, overwrite)
             result.new_revno, result.new_revid = self.last_revision_info()
             if _hook_master:
                 result.master_branch = _hook_master
@@ -1594,7 +1594,7 @@
                 raise
         if overwrite:
             target.set_revision_history(self.revision_history())
-        result.tag_conflicts = self.tags.merge_to(target.tags)
+        result.tag_conflicts = self.tags.merge_to(target.tags, overwrite)
         result.new_revno, result.new_revid = target.last_revision_info()
         return result
 

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2007-09-05 08:18:57 +0000
+++ b/bzrlib/builtins.py	2007-09-10 10:05:51 +0000
@@ -2552,7 +2552,7 @@
                      ]
     encoding_type = 'replace'
 
-    def run(self, testspecs_list=None, verbose=None, one=False,
+    def run(self, testspecs_list=None, verbose=False, one=False,
             transport=None, benchmark=None,
             lsprof_timed=None, cache_dir=None,
             first=False, list_only=False,
@@ -2578,14 +2578,12 @@
             pattern = ".*"
         if benchmark:
             test_suite_factory = benchmarks.test_suite
-            if verbose is None:
-                verbose = True
+            # Unless user explicitly asks for quiet, be verbose in benchmarks
+            verbose = not is_quiet()
             # TODO: should possibly lock the history file...
             benchfile = open(".perf_history", "at", buffering=1)
         else:
             test_suite_factory = None
-            if verbose is None:
-                verbose = False
             benchfile = None
         try:
             result = selftest(verbose=verbose,
@@ -3867,7 +3865,7 @@
 
     encoding_type = 'exact'
 
-    _see_also = ['merge', 'doc/configuration.txt']
+    _see_also = ['merge']
 
     takes_args = ['submit_branch?', 'public_branch?']
 

=== modified file 'bzrlib/help_topics.py'
--- a/bzrlib/help_topics.py	2007-09-03 01:33:49 +0000
+++ b/bzrlib/help_topics.py	2007-09-07 03:42:41 +0000
@@ -446,6 +446,37 @@
                this will update the tree to match the branch.
 """
 
+
+_branches = \
+"""Branches
+
+A branch consists of the state of a project, including all of its
+history. All branches have a repository associated (which is where the
+branch history is stored), but multiple branches may share the same
+repository (a shared repository). Branches can be copied and merged.
+
+Related commands::
+
+  init    Make a directory into a versioned branch.
+  branch  Create a new copy of a branch.
+  merge   Perform a three-way merge.
+"""
+
+
+_standalone_trees = \
+"""Standalone Trees
+
+A standalone tree is a working tree with an associated repository. It
+is an independently usable branch, with no dependencies on any other.
+Creating a standalone tree (via bzr init) is the quickest way to put
+an existing project under version control.
+
+Related Commands::
+
+  init    Make a directory into a versioned branch.
+"""
+
+
 _status_flags = \
 """Status Flags
 
@@ -516,6 +547,7 @@
 """
 
 
+# Register help topics
 topic_registry.register("revisionspec", _help_on_revisionspec,
                         "Explain how to use --revision")
 topic_registry.register('basic', _basic_help, "Basic commands", SECT_HIDDEN)
@@ -528,8 +560,6 @@
                         'Options that can be used with any command')
 topic_registry.register('global-options', _global_options,
                     'Options that control how Bazaar runs')
-topic_registry.register('checkouts', _checkouts,
-                        'Information on what a checkout is', SECT_CONCEPT)
 topic_registry.register('urlspec', _help_on_transport,
                         "Supported transport protocols")
 topic_registry.register('status-flags', _status_flags,
@@ -538,15 +568,28 @@
     from bzrlib import bugtracker
     return "Bug Trackers\n\n" + bugtracker.tracker_registry.help_topic(topic)
 topic_registry.register('bugs', get_bugs_topic, 'Bug tracker support')
+topic_registry.register('env-variables', _env_variables,
+                        'Environment variable names and values')
+topic_registry.register('files', _files,
+                        'Information on configuration and log files')
+
+
+# Register concept topics.
+# Note that we might choose to remove these from the online help in the
+# future or implement them via loading content from files. In the meantime,
+# please keep them concise.
+topic_registry.register('branches', _branches,
+                        'Information on what a branch is', SECT_CONCEPT)
+topic_registry.register('checkouts', _checkouts,
+                        'Information on what a checkout is', SECT_CONCEPT)
 topic_registry.register('repositories', _repositories,
                         'Basic information on shared repositories.',
                         SECT_CONCEPT)
+topic_registry.register('standalone-trees', _standalone_trees,
+                        'Information on what a standalone tree is',
+                        SECT_CONCEPT)
 topic_registry.register('working-trees', _working_trees,
                         'Information on working trees', SECT_CONCEPT)
-topic_registry.register('env-variables', _env_variables,
-                        'Environment variable names and values')
-topic_registry.register('files', _files,
-                        'Information on configuration and log files')
 
 
 class HelpTopicIndex(object):

=== modified file 'bzrlib/repofmt/weaverepo.py'
--- a/bzrlib/repofmt/weaverepo.py	2007-08-15 04:56:08 +0000
+++ b/bzrlib/repofmt/weaverepo.py	2007-09-09 22:01:56 +0000
@@ -14,8 +14,11 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+"""Deprecated weave-based repository formats.
 
-"""Old weave-based repository formats"""
+Weave based formats scaled linearly with history size and could not represent
+ghosts.
+"""
 
 from StringIO import StringIO
 
@@ -23,12 +26,14 @@
     bzrdir,
     lockable_files,
     lockdir,
+    osutils,
     weave,
     weavefile,
     xml5,
     )
 from bzrlib.decorators import needs_read_lock, needs_write_lock
 from bzrlib.repository import (
+    CommitBuilder,
     MetaDirRepository,
     MetaDirRepositoryFormat,
     Repository,
@@ -73,8 +78,11 @@
                            timezone=None, committer=None, revprops=None,
                            revision_id=None):
         self._check_ascii_revisionid(revision_id, self.get_commit_builder)
-        return Repository.get_commit_builder(self, branch, parents, config,
-            timestamp, timezone, committer, revprops, revision_id)
+        revision_id = osutils.safe_revision_id(revision_id)
+        result = WeaveCommitBuilder(self, parents, config, timestamp, timezone,
+                              committer, revprops, revision_id)
+        self.start_write_group()
+        return result
 
     @needs_read_lock
     def is_shared(self):
@@ -107,8 +115,11 @@
                            timezone=None, committer=None, revprops=None,
                            revision_id=None):
         self._check_ascii_revisionid(revision_id, self.get_commit_builder)
-        return MetaDirRepository.get_commit_builder(self, branch, parents,
-            config, timestamp, timezone, committer, revprops, revision_id)
+        revision_id = osutils.safe_revision_id(revision_id)
+        result = WeaveCommitBuilder(self, parents, config, timestamp, timezone,
+                              committer, revprops, revision_id)
+        self.start_write_group()
+        return result
 
 
 class PreSplitOutRepositoryFormat(RepositoryFormat):
@@ -398,6 +409,18 @@
             text_store=text_store)
 
 
+class WeaveCommitBuilder(CommitBuilder):
+    """A builder for weave based repos that don't support ghosts."""
+
+    def _add_text_to_weave(self, file_id, new_lines, parents):
+        versionedfile = self.repository.weave_store.get_weave_or_empty(
+            file_id, self.repository.get_transaction())
+        result = versionedfile.add_lines(
+            self._new_revision_id, parents, new_lines)[0:2]
+        versionedfile.clear_cache()
+        return result
+
+
 _legacy_formats = [RepositoryFormat4(),
                    RepositoryFormat5(),
                    RepositoryFormat6()]

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2007-09-10 03:53:04 +0000
+++ b/bzrlib/repository.py	2007-09-11 04:18:23 +0000
@@ -447,8 +447,8 @@
     def create_bundle(self, target, base, fileobj, format=None):
         return serializer.write_bundle(self, target, base, fileobj, format)
 
-    def get_commit_builder(self, branch, parents, config, timestamp=None, 
-                           timezone=None, committer=None, revprops=None, 
+    def get_commit_builder(self, branch, parents, config, timestamp=None,
+                           timezone=None, committer=None, revprops=None,
                            revision_id=None):
         """Obtain a CommitBuilder for this repository.
         
@@ -462,7 +462,7 @@
         :param revision_id: Optional revision id.
         """
         revision_id = osutils.safe_revision_id(revision_id)
-        result =_CommitBuilder(self, parents, config, timestamp, timezone,
+        result = CommitBuilder(self, parents, config, timestamp, timezone,
                               committer, revprops, revision_id)
         self.start_write_group()
         return result
@@ -2073,7 +2073,9 @@
     know the internals of the format of the repository.
     """
     
-    record_root_entry = False
+    # all clients should supply tree roots.
+    record_root_entry = True
+
     def __init__(self, repository, parents, config, timestamp=None, 
                  timezone=None, committer=None, revprops=None, 
                  revision_id=None):
@@ -2298,27 +2300,19 @@
     def _add_text_to_weave(self, file_id, new_lines, parents):
         versionedfile = self.repository.weave_store.get_weave_or_empty(
             file_id, self.repository.get_transaction())
-        result = versionedfile.add_lines(
+        # Don't change this to add_lines - add_lines_with_ghosts is cheaper
+        # than add_lines, and allows committing when a parent is ghosted for
+        # some reason.
+        result = versionedfile.add_lines_with_ghosts(
             self._new_revision_id, parents, new_lines,
             random_id=self.random_revid)[0:2]
         versionedfile.clear_cache()
         return result
 
 
-class _CommitBuilder(CommitBuilder):
-    """Temporary class so old CommitBuilders are detected properly
-    
-    Note: CommitBuilder works whether or not root entry is recorded.
-    """
-
-    record_root_entry = True
-
-
 class RootCommitBuilder(CommitBuilder):
     """This commitbuilder actually records the root id"""
     
-    record_root_entry = True
-
     def _check_root(self, ie, parent_invs, tree):
         """Helper for record_entry_contents.
 

=== modified file 'bzrlib/tag.py'
--- a/bzrlib/tag.py	2007-04-19 19:28:39 +0000
+++ b/bzrlib/tag.py	2007-09-11 00:15:56 +0000
@@ -62,7 +62,7 @@
     lookup_tag = _not_supported
     delete_tag = _not_supported
 
-    def merge_to(self, to_tags):
+    def merge_to(self, to_tags, overwrite=False):
         # we never have anything to copy
         pass
 
@@ -143,7 +143,7 @@
 
         :param new_dict: Dictionary from tag name to target.
         """
-        self.branch.lock_read()
+        self.branch.lock_write()
         try:
             self.branch._transport.put_bytes('tags',
                 self._serialize_tag_dict(new_dict))
@@ -170,7 +170,7 @@
             raise ValueError("failed to deserialize tag dictionary %r: %s"
                 % (tag_content, e))
 
-    def merge_to(self, to_tags):
+    def merge_to(self, to_tags, overwrite=False):
         """Copy tags between repositories if necessary and possible.
         
         This method has common command-line behaviour about handling 
@@ -180,9 +180,7 @@
         exist keep their existing definitions.
 
         :param to_tags: Branch to receive these tags
-        :param just_warn: If the destination doesn't support tags and the 
-            source does have tags, just give a warning.  Otherwise, raise
-            TagsNotSupported (default).
+        :param overwrite: Overwrite conflicting tags in the target branch
 
         :returns: A list of tags that conflicted, each of which is 
             (tagname, source_target, dest_target).
@@ -200,20 +198,22 @@
         to_tags.branch.lock_write()
         try:
             dest_dict = to_tags.get_tag_dict()
-            result, conflicts = self._reconcile_tags(source_dict, dest_dict)
+            result, conflicts = self._reconcile_tags(source_dict, dest_dict,
+                                                     overwrite)
             if result != dest_dict:
                 to_tags._set_tag_dict(result)
         finally:
             to_tags.branch.unlock()
         return conflicts
 
-    def _reconcile_tags(self, source_dict, dest_dict):
+    def _reconcile_tags(self, source_dict, dest_dict, overwrite):
         """Do a two-way merge of two tag dictionaries.
 
         only in source => source value
         only in destination => destination value
         same definitions => that
-        different definitions => keep destination value, give a warning
+        different definitions => if overwrite is False, keep destination
+            value and give a warning, otherwise use the source value
 
         :returns: (result_dict,
             [(conflicting_tag, source_target, dest_target)])
@@ -221,7 +221,7 @@
         conflicts = []
         result = dict(dest_dict) # copy
         for name, target in source_dict.items():
-            if name not in result:
+            if name not in result or overwrite:
                 result[name] = target
             elif result[name] == target:
                 pass

=== modified file 'bzrlib/tests/test_tag.py'
--- a/bzrlib/tests/test_tag.py	2007-03-14 03:42:40 +0000
+++ b/bzrlib/tests/test_tag.py	2007-09-07 11:37:13 +0000
@@ -78,3 +78,23 @@
         old_branch.tags.merge_to(new_branch.tags)
         self.assertRaises(errors.TagsNotSupported,
             new_branch.tags.merge_to, old_branch.tags)
+
+    def test_merge_to(self):
+        a = self.make_branch_supporting_tags('a')
+        b = self.make_branch_supporting_tags('b')
+        # simple merge
+        a.tags.set_tag('tag-1', 'x')
+        b.tags.set_tag('tag-2', 'y')
+        a.tags.merge_to(b.tags)
+        self.assertEqual('x', b.tags.lookup_tag('tag-1'))
+        self.assertEqual('y', b.tags.lookup_tag('tag-2'))
+        self.assertRaises(errors.NoSuchTag, a.tags.lookup_tag, 'tag-2')
+        # conflicting merge
+        a.tags.set_tag('tag-2', 'z')
+        conflicts = a.tags.merge_to(b.tags)
+        self.assertEqual(conflicts, [('tag-2', 'z', 'y')])
+        self.assertEqual('y', b.tags.lookup_tag('tag-2'))
+        # overwrite conflicts
+        conflicts = a.tags.merge_to(b.tags, overwrite=True)
+        self.assertEqual(conflicts, [])
+        self.assertEqual('z', b.tags.lookup_tag('tag-2'))

=== modified file 'bzrlib/transport/__init__.py'
--- a/bzrlib/transport/__init__.py	2007-08-22 01:41:24 +0000
+++ b/bzrlib/transport/__init__.py	2007-09-10 09:27:54 +0000
@@ -369,10 +369,10 @@
         """
         # The default implementation just uses "Easier to ask for forgiveness
         # than permission". We attempt to create the directory, and just
-        # suppress a FileExists exception.
+        # suppress FileExists and PermissionDenied (for Windows) exceptions.
         try:
             self.mkdir('.')
-        except errors.FileExists:
+        except (errors.FileExists, errors.PermissionDenied):
             return False
         else:
             return True

=== modified file 'doc/developers/HACKING.txt'
--- a/doc/developers/HACKING.txt	2007-09-06 02:39:24 +0000
+++ b/doc/developers/HACKING.txt	2007-09-10 10:05:51 +0000
@@ -624,12 +624,93 @@
 Coding Style Guidelines
 =======================
 
+Code layout
+-----------
+
 Please write PEP-8__ compliant code.  
 
+__ http://www.python.org/peps/pep-0008.html
+
 One often-missed requirement is that the first line of docstrings
 should be a self-contained one-sentence summary.
 
-__ http://www.python.org/peps/pep-0008.html
+We use 4 space indents for blocks, and never use tab characters.  (In vim,
+``set expandtab``.)
+
+Lines should be no more than 79 characters if at all possible.
+Lines that continue a long statement may be indented in either of 
+two ways:
+
+within the parenthesis or other character that opens the block, e.g.::
+
+    my_long_method(arg1,
+                   arg2,
+                   arg3)
+
+or indented by four spaces::
+
+    my_long_method(arg1,
+        arg2,
+        arg3)
+
+The first is considered clearer by some people; however it can be a bit
+harder to maintain (e.g. when the method name changes), and it does not
+work well if the relevant parenthesis is already far to the right.  Avoid
+this::
+
+     self.legbone.kneebone.shinbone.toebone.shake_it(one,
+                                                     two,
+                                                     three)
+
+but rather ::
+
+     self.legbone.kneebone.shinbone.toebone.shake_it(one,
+         two,
+         three)
+
+or ::
+
+     self.legbone.kneebone.shinbone.toebone.shake_it(
+         one, two, three)
+
+For long lists, we like to add a trailing comma and put the closing
+character on the following line.  This makes it easier to add new items in
+future::
+
+    from bzrlib.goo import (
+        jam,
+        jelly,
+        marmalade,
+        )
+
+There should be spaces between function paramaters, but not between the
+keyword name and the value::
+
+    call(1, 3, cheese=quark)
+
+In emacs::
+
+    ;(defface my-invalid-face
+    ;  '((t (:background "Red" :underline t)))
+    ;  "Face used to highlight invalid constructs or other uglyties"
+    ;  )
+
+    (defun my-python-mode-hook ()
+     ;; setup preferred indentation style.
+     (setq fill-column 79)
+     (setq indent-tabs-mode nil) ; no tabs, never, I will not repeat
+    ;  (font-lock-add-keywords 'python-mode
+    ;                         '(("^\\s *\t" . 'my-invalid-face) ; Leading tabs
+    ;                            ("[ \t]+$" . 'my-invalid-face)  ; Trailing spaces
+    ;                            ("^[ \t]+$" . 'my-invalid-face)); Spaces only
+    ;                          )
+     )
+
+    (add-hook 'python-mode-hook 'my-python-mode-hook)
+
+The lines beginning with ';' are comments. They can be activated
+if one want to have a strong notice of some tab/space usage
+violations.
 
 
 Module Imports



More information about the bazaar-commits mailing list