Rev 3196: Preserve tags when reconfiguring in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jan 22 22:50:36 GMT 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3196
revision-id:pqm at pqm.ubuntu.com-20080122225027-vp7xsc3kue1uw2r5
parent: pqm at pqm.ubuntu.com-20080122004623-p8kb5y8dehs5cmho
parent: abentley at panoramicfeedback.com-20080118040021-xd6dgscnnmj3lftm
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2008-01-22 22:50:27 +0000
message:
  Preserve tags when reconfiguring
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/reconfigure.py          reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
  bzrlib/tests/test_reconfigure.py test_reconfigure.py-20070908040425-6ykgo7escxhyrg9p-2
    ------------------------------------------------------------
    revno: 2796.2.36
    revision-id:abentley at panoramicfeedback.com-20080118040021-xd6dgscnnmj3lftm
    parent: abentley at panoramicfeedback.com-20080118035600-kuif0nzz2kbb4728
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr.reconfigure
    timestamp: Thu 2008-01-17 23:00:21 -0500
    message:
      Remove spurious whitespace change in NEWS
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 2796.2.35
    revision-id:abentley at panoramicfeedback.com-20080118035600-kuif0nzz2kbb4728
    parent: abentley at panoramicfeedback.com-20080118035418-calpmgx847d23o49
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr.reconfigure
    timestamp: Thu 2008-01-17 22:56:00 -0500
    message:
      Update NEWS
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 2796.2.34
    revision-id:abentley at panoramicfeedback.com-20080118035418-calpmgx847d23o49
    parent: abentley at panoramicfeedback.com-20080118035352-kvjf5v87xwfet04n
    parent: pqm at pqm.ubuntu.com-20080117151706-6jqnhytwgt1xfttw
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr.reconfigure
    timestamp: Thu 2008-01-17 22:54:18 -0500
    message:
      Merge bzr.dev
    added:
      doc/en/user-guide/revnos.txt   revnos.txt-20080111231928-pbntxea0ynh9ww1t-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzr                            bzr.py-20050313053754-5485f144c7006fa6
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      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/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/revisiontree.py         revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
      bzrlib/smart/client.py         client.py-20061116014825-2k6ada6xgulslami-1
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
      bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
      bzrlib/smart/request.py        request.py-20061108095550-gunadhxmzkdjfeek-1
      bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
      bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
      bzrlib/tests/test_annotate.py  test_annotate.py-20061213215015-sttc9agsxomls7q0-1
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/tests/test_log.py       testlog.py-20050728115707-1a514809d7d49309
      bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
      bzrlib/tests/test_merge_core.py test_merge_core.py-20050824132511-eb99b23a0eec641b
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
      bzrlib/tests/test_smart.py     test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
      bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/tests/test_tsort.py     testtsort.py-20051025073946-27da871c394d5be4
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
      bzrlib/transport/remote.py     ssh.py-20060608202016-c25gvf1ob7ypbus6-1
      bzrlib/tsort.py                tsort.py-20051025073946-7808f6aaf7d07208
      doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
      doc/en/tutorials/using_bazaar_with_launchpad.txt using_bazaar_with_lp-20071211073140-7msh8uf9a9h4y9hb-1
      doc/en/user-guide/controlling_registration.txt controlling_registra-20071121073725-0corxykv5irjal00-3
      doc/en/user-guide/core_concepts.txt core_concepts.txt-20071114035000-q36a9h57ps06uvnl-2
      doc/en/user-guide/index.txt    index.txt-20060622101119-tgwtdci8z769bjb9-2
    ------------------------------------------------------------
    revno: 2796.2.33
    revision-id:abentley at panoramicfeedback.com-20080118035352-kvjf5v87xwfet04n
    parent: abentley at panoramicfeedback.com-20080118033347-rxtxoegi3w0nocj6
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr.reconfigure
    timestamp: Thu 2008-01-17 22:53:52 -0500
    message:
      Add lightweight-checkout-to-checkout tags test
    modified:
      bzrlib/tests/test_reconfigure.py test_reconfigure.py-20070908040425-6ykgo7escxhyrg9p-2
    ------------------------------------------------------------
    revno: 2796.2.32
    revision-id:abentley at panoramicfeedback.com-20080118033347-rxtxoegi3w0nocj6
    parent: abentley at panoramicfeedback.com-20080118032607-fshdeo5nl22bx75g
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr.reconfigure
    timestamp: Thu 2008-01-17 22:33:47 -0500
    message:
      Preserve tags converting from lightweight checkouts
    modified:
      bzrlib/reconfigure.py          reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
      bzrlib/tests/test_reconfigure.py test_reconfigure.py-20070908040425-6ykgo7escxhyrg9p-2
    ------------------------------------------------------------
    revno: 2796.2.31
    revision-id:abentley at panoramicfeedback.com-20080118032607-fshdeo5nl22bx75g
    parent: abentley at panoramicfeedback.com-20080111175920-dn202iylc1kfdfif
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr.reconfigure
    timestamp: Thu 2008-01-17 22:26:07 -0500
    message:
      Fetch tags to reference branch when converting to checkout
    modified:
      bzrlib/reconfigure.py          reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
      bzrlib/tests/test_reconfigure.py test_reconfigure.py-20070908040425-6ykgo7escxhyrg9p-2
=== modified file 'NEWS'
--- a/NEWS	2008-01-21 01:06:30 +0000
+++ b/NEWS	2008-01-22 22:50:27 +0000
@@ -47,6 +47,9 @@
     * ``reconfigure`` can safely be interrupted while fetching.
       (Aaron Bentley, #179316)
 
+    * ``reconfigure`` preserves tags when converting to and from lightweight
+      checkouts.  (Aaron Bentley, #182040)
+
     * Unknown hostnames when connecting to a ``bzr://`` URL no longer cause
       tracebacks.  (Andrew Bennetts, #182849)
 

=== modified file 'bzrlib/reconfigure.py'
--- a/bzrlib/reconfigure.py	2008-01-11 17:59:20 +0000
+++ b/bzrlib/reconfigure.py	2008-01-18 03:33:47 +0000
@@ -133,6 +133,8 @@
         if self.referenced_branch is None:
             if want_reference:
                 self._create_reference = True
+                if self.local_branch is not None:
+                    self._destroy_branch = True
         else:
             if not want_reference:
                 self._destroy_reference = True
@@ -227,11 +229,15 @@
             self.bzrdir.destroy_branch()
         if self._destroy_branch:
             last_revision_info = self.local_branch.last_revision_info()
+            if self._create_reference:
+                self.local_branch.tags.merge_to(reference_branch.tags)
             self.bzrdir.destroy_branch()
         if self._create_branch:
             local_branch = self.bzrdir.create_branch()
             if last_revision_info is not None:
                 local_branch.set_last_revision_info(*last_revision_info)
+            if self._destroy_reference:
+                self.referenced_branch.tags.merge_to(local_branch.tags)
         else:
             local_branch = self.local_branch
         if self._create_reference:

=== modified file 'bzrlib/tests/test_reconfigure.py'
--- a/bzrlib/tests/test_reconfigure.py	2008-01-11 17:59:20 +0000
+++ b/bzrlib/tests/test_reconfigure.py	2008-01-18 03:53:52 +0000
@@ -60,11 +60,16 @@
         reconfiguration.apply()
         self.assertIs(None, checkout.branch.get_bound_location())
 
+    def prepare_lightweight_checkout_to_branch(self):
+        branch = self.make_branch('branch')
+        checkout = branch.create_checkout('checkout', lightweight=True)
+        checkout.commit('first commit', rev_id='rev1')
+        reconfiguration = reconfigure.Reconfigure.to_branch(checkout.bzrdir)
+        return reconfiguration, checkout
+
     def test_lightweight_checkout_to_branch(self):
-        branch = self.make_branch('branch')
-        checkout = branch.create_checkout('checkout', lightweight=True)
-        checkout.commit('first commit', rev_id='rev1')
-        reconfiguration = reconfigure.Reconfigure.to_branch(checkout.bzrdir)
+        reconfiguration, checkout = \
+            self.prepare_lightweight_checkout_to_branch()
         reconfiguration.apply()
         checkout_branch = checkout.bzrdir.open_branch()
         self.assertEqual(checkout_branch.bzrdir.root_transport.base,
@@ -73,14 +78,35 @@
         repo = checkout.bzrdir.open_repository()
         repo.get_revision('rev1')
 
+    def test_lightweight_checkout_to_branch_tags(self):
+        reconfiguration, checkout = \
+            self.prepare_lightweight_checkout_to_branch()
+        checkout.branch.tags.set_tag('foo', 'bar')
+        reconfiguration.apply()
+        checkout_branch = checkout.bzrdir.open_branch()
+        self.assertEqual('bar', checkout_branch.tags.lookup_tag('foo'))
+
+    def prepare_lightweight_checkout_to_checkout(self):
+        branch = self.make_branch('branch')
+        checkout = branch.create_checkout('checkout', lightweight=True)
+        reconfiguration = reconfigure.Reconfigure.to_checkout(checkout.bzrdir)
+        return reconfiguration, checkout
+
     def test_lightweight_checkout_to_checkout(self):
-        branch = self.make_branch('branch')
-        checkout = branch.create_checkout('checkout', lightweight=True)
-        reconfiguration = reconfigure.Reconfigure.to_checkout(checkout.bzrdir)
+        reconfiguration, checkout = \
+            self.prepare_lightweight_checkout_to_checkout()
         reconfiguration.apply()
         checkout_branch = checkout.bzrdir.open_branch()
         self.assertIsNot(checkout_branch.get_bound_location(), None)
 
+    def test_lightweight_checkout_to_checkout_tags(self):
+        reconfiguration, checkout = \
+            self.prepare_lightweight_checkout_to_checkout()
+        checkout.branch.tags.set_tag('foo', 'bar')
+        reconfiguration.apply()
+        checkout_branch = checkout.bzrdir.open_branch()
+        self.assertEqual('bar', checkout_branch.tags.lookup_tag('foo'))
+
     def test_lightweight_conversion_uses_shared_repo(self):
         parent = self.make_branch('parent')
         shared_repo = self.make_repository('repo', shared=True)
@@ -185,14 +211,20 @@
         self.assertRaises(errors.NoRepositoryPresent,
                           checkout.bzrdir.open_repository)
 
+    def prepare_branch_to_lightweight_checkout(self):
+        parent = self.make_branch('parent')
+        child = parent.bzrdir.sprout('child').open_workingtree()
+        child.commit('test', rev_id='new-commit')
+        child.bzrdir.destroy_workingtree()
+        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
+            child.bzrdir)
+        return parent, child, reconfiguration
+
     def test_branch_to_lightweight_checkout(self):
-        parent = self.make_branch('parent')
-        child = parent.bzrdir.sprout('child').open_workingtree()
-        child.commit('test', rev_id='new-commit')
-        child.bzrdir.destroy_workingtree()
-        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
-            child.bzrdir)
+        parent, child, reconfiguration = \
+            self.prepare_branch_to_lightweight_checkout()
         reconfiguration.apply()
+        self.assertTrue(reconfiguration._destroy_branch)
         wt = child.bzrdir.open_workingtree()
         self.assertTrue(parent.repository.has_same_location(
             wt.branch.repository))
@@ -201,11 +233,8 @@
                           child.bzrdir.open_repository)
 
     def test_branch_to_lightweight_checkout_failure(self):
-        parent = self.make_branch('parent')
-        child = parent.bzrdir.sprout('child').open_workingtree()
-        child.commit('test', rev_id='new-commit')
-        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
-            child.bzrdir)
+        parent, child, reconfiguration = \
+            self.prepare_branch_to_lightweight_checkout()
         old_Repository_fetch = repository.Repository.fetch
         repository.Repository.fetch = None
         try:
@@ -215,6 +244,14 @@
         child = _mod_branch.Branch.open('child')
         self.assertContainsRe(child.base, 'child/$')
 
+    def test_branch_to_lightweight_checkout_fetch_tags(self):
+        parent, child, reconfiguration = \
+            self.prepare_branch_to_lightweight_checkout()
+        child.branch.tags.set_tag('foo', 'bar')
+        reconfiguration.apply()
+        child = _mod_branch.Branch.open('child')
+        self.assertEqual('bar', parent.tags.lookup_tag('foo'))
+
     def test_lightweight_checkout_to_lightweight_checkout(self):
         parent = self.make_branch('parent')
         checkout = parent.create_checkout('checkout', lightweight=True)




More information about the bazaar-commits mailing list