Rev 3028: Revert of single files in deleted directories works in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Nov 26 20:55:36 GMT 2007


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

------------------------------------------------------------
revno: 3028
revision-id:pqm at pqm.ubuntu.com-20071126205533-5vehpxjf6uk2n8fy
parent: pqm at pqm.ubuntu.com-20071126201850-7bugi709x0jjfqpg
parent: abentley at panoramicfeedback.com-20071126200031-bf33kxb528sokzsl
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2007-11-26 20:55:33 +0000
message:
  Revert of single files in deleted directories works
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/test_revert.py    test_revert.py-20060828180832-fqb1v6ecpyvnlitj-1
  bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.9
    revision-id:abentley at panoramicfeedback.com-20071126200031-bf33kxb528sokzsl
    parent: abentley at panoramicfeedback.com-20071126195409-joxaj1oc8vkxbhcv
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Mon 2007-11-26 15:00:31 -0500
    message:
      Update from review
    modified:
      bzrlib/tests/test_revert.py    test_revert.py-20060828180832-fqb1v6ecpyvnlitj-1
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.8
    revision-id:abentley at panoramicfeedback.com-20071126195409-joxaj1oc8vkxbhcv
    parent: abentley at panoramicfeedback.com-20071123145054-s505aar7vfacxi4q
    parent: pqm at pqm.ubuntu.com-20071126151329-pnmm49obwettpwcd
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Mon 2007-11-26 14:54:09 -0500
    message:
      Merge bzr.dev
    renamed:
      doc/developers/knitpack.txt => doc/developers/packrepo.txt knitpack.txt-20071023074744-q0g5u8me8gk5zbtb-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
      bzrlib/conflicts.py            conflicts.py-20051001061850-78ef952ba63d2b42
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
      bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
      bzrlib/tests/ftp_server.py     ftpserver.py-20071019102346-61jbvdkrr70igauv-1
      bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
      bzrlib/tests/test_conflicts.py test_conflicts.py-20051006031059-e2dad9bbeaa5891f
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
      bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/tests/test_transport.py testtransport.py-20050718175618-e5cdb99f4555ddce
      bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
      bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
      bzrlib/transport/ftp.py        ftp.py-20051116161804-58dc9506548c2a53
      bzrlib/transport/remote.py     ssh.py-20060608202016-c25gvf1ob7ypbus6-1
      bzrlib/util/configobj/configobj.py configobj.py-20051018184548-06992a2246425e3e
      bzrlib/util/configobj/docs/BSD-LICENSE.txt BSDLICENSE.txt-20051018184548-29b89ff3102657f5
      bzrlib/util/configobj/docs/configobj.txt configobj.txt-20051018184548-4949b5f17e6a19c7
      bzrlib/util/configobj/docs/validate.txt validate.txt-20051018184548-9e0e5ad913e258f5
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      doc/developers/packrepo.txt    knitpack.txt-20071023074744-q0g5u8me8gk5zbtb-1
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.7
    revision-id:abentley at panoramicfeedback.com-20071123145054-s505aar7vfacxi4q
    parent: abentley at panoramicfeedback.com-20071123144718-ax42ydiszzmfgjp4
    parent: pqm at pqm.ubuntu.com-20071123053719-gxfu09uacv4heh6w
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-11-23 09:50:54 -0500
    message:
      Merge bzr.dev
    modified:
      bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
      bzrlib/transport/memory.py     memory.py-20051016101338-cd008dbdf69f04fc
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.6
    revision-id:abentley at panoramicfeedback.com-20071123144718-ax42ydiszzmfgjp4
    parent: abentley at panoramicfeedback.com-20071123142218-23kpodwqohb9oabv
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-11-23 09:47:18 -0500
    message:
      Revert doesn't crash restoring a file from a deleted directory
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.5
    revision-id:abentley at panoramicfeedback.com-20071123142218-23kpodwqohb9oabv
    parent: aaron.bentley at utoronto.ca-20071123140933-qwrs22s00rpeqmt7
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-11-23 09:22:18 -0500
    message:
      Fix revert when parent dir is missing
    modified:
      bzrlib/tests/test_revert.py    test_revert.py-20060828180832-fqb1v6ecpyvnlitj-1
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.4
    revision-id:aaron.bentley at utoronto.ca-20071123140933-qwrs22s00rpeqmt7
    parent: aaron.bentley at utoronto.ca-20071123051912-d7uajj7tdxsqkx4y
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-11-23 09:09:33 -0500
    message:
      Add failing test case
    modified:
      bzrlib/tests/test_revert.py    test_revert.py-20060828180832-fqb1v6ecpyvnlitj-1
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.3
    revision-id:aaron.bentley at utoronto.ca-20071123051912-d7uajj7tdxsqkx4y
    parent: abentley at panoramicfeedback.com-20071121222444-l8qropwv3vcedv1j
    parent: pqm at pqm.ubuntu.com-20071123043953-lv68pawzrpa4s9t9
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-11-23 00:19:12 -0500
    message:
      Merge bzr.dev
    added:
      bzrlib/switch.py               switch.py-20071116011000-v5lnw7d2wkng9eux-1
      bzrlib/tests/blackbox/test_switch.py test_switch.py-20071122111948-0c5en6uz92bwl76h-1
      bzrlib/tests/repository_implementations/test__generate_text_key_index.py test__generate_text_-20071114232121-00h9fd8qg8kjfa5k-1
      bzrlib/tests/repository_implementations/test_find_text_key_references.py test_find_text_key_r-20071114033605-v73bakal8x77qlfi-1
      bzrlib/tests/test_switch.py    test_switch.py-20071116011000-v5lnw7d2wkng9eux-2
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/annotate.py             annotate.py-20050922133147-7c60541d2614f022
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/check.py                check.py-20050309040759-f3a679400c06bcc1
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/msgeditor.py            msgeditor.py-20050901111708-ef6d8de98f5d8f2f
      bzrlib/reconcile.py            reweave_inventory.py-20051108164726-1e5e0934febac06e
      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/revision.py             revision.py-20050309040759-e77802c08f3999d5
      bzrlib/revisionspec.py         revisionspec.py-20050907152633-17567659fd5c0ddb
      bzrlib/sign_my_commits.py      sign_my_commits.py-20060215152201-5a6363365180e671
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/__init__.py __init__.py-20051128053524-eba30d8255e08dc3
      bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
      bzrlib/tests/blackbox/test_reconcile.py test_fix.py-20060223013051-9a188e15a5ee9451
      bzrlib/tests/blackbox/test_versioning.py versioning.py-20050622071821-3ddf5e2e5e93c602
      bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
      bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
      bzrlib/tests/repository_implementations/test_check.py test_check.py-20070824124512-38g4d135gcqxo4zb-1
      bzrlib/tests/repository_implementations/test_check_reconcile.py test_broken.py-20070928125406-62236394w0jpbpd6-2
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_annotate.py  test_annotate.py-20061213215015-sttc9agsxomls7q0-1
      bzrlib/tests/test_commit.py    test_commit.py-20050914060732-279f057f8c295434
      bzrlib/tests/test_dirstate.py  test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
      bzrlib/tests/test_memorytree.py test_memorytree.py-20060906023413-4wlkalbdpsxi2r4y-3
      bzrlib/tests/test_merge_core.py test_merge_core.py-20050824132511-eb99b23a0eec641b
      bzrlib/tests/test_merge_directive.py test_merge_directive-20070228184838-ja62280spt1g7f4x-2
      bzrlib/tests/test_msgeditor.py test_msgeditor.py-20051202041359-920315ec6011ee51
      bzrlib/transport/local.py      local_transport.py-20050711165921-9b1f142bfe480c24
=== modified file 'NEWS'
--- a/NEWS	2007-11-26 13:55:51 +0000
+++ b/NEWS	2007-11-26 19:54:09 +0000
@@ -128,6 +128,9 @@
      symlink on some platforms (e.g. on Windows).
      (Alexander Belchenko, workaround for #81689)
 
+   * Revert doesn't crash when restoring a single file from a deleted
+     directory. (Aaron Bentley)
+
    * Stderr output via logging mechanism now goes through encoded wrapper
      and no more uses utf-8, but terminal encoding instead. So all unicode
      strings now should be readable in non-utf-8 terminal.

=== modified file 'bzrlib/tests/test_revert.py'
--- a/bzrlib/tests/test_revert.py	2007-08-29 20:41:28 +0000
+++ b/bzrlib/tests/test_revert.py	2007-11-26 20:00:31 +0000
@@ -132,3 +132,18 @@
             ' as of bzr 0.91.  Please use None (the default) instead.'],
             tree.revert, [])
         self.assertIs(None, tree.path2id('file'))
+
+    def test_revert_file_in_deleted_dir(self):
+        tree = self.make_branch_and_tree('.')
+        self.build_tree(['dir/', 'dir/file1', 'dir/file2'])
+        tree.add(['dir', 'dir/file1', 'dir/file2'],
+                 ['dir-id', 'file1-id', 'file2-id'])
+        tree.commit("Added files")
+        os.unlink('dir/file1')
+        os.unlink('dir/file2')
+        os.rmdir('dir')
+        tree.remove(['dir/', 'dir/file1', 'dir/file2'])
+        tree.revert(['dir/file1'])
+        self.failUnlessExists('dir/file1')
+        self.failIfExists('dir/file2')
+        self.assertEqual('dir-id', tree.path2id('dir'))

=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py	2007-11-23 08:31:24 +0000
+++ b/bzrlib/tests/test_transform.py	2007-11-26 19:54:09 +0000
@@ -1489,3 +1489,11 @@
                           _mover=self.ExceptionFileMover(bad_target='d'))
         self.failUnlessExists('a')
         self.failUnlessExists('a/b')
+
+    def test_resolve_no_parent(self):
+        wt = self.make_branch_and_tree('.')
+        tt = TreeTransform(wt)
+        self.addCleanup(tt.finalize)
+        parent = tt.trans_id_file_id('parent-id')
+        tt.new_file('file', parent, 'Contents')
+        resolve_conflicts(tt)

=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2007-11-25 16:42:55 +0000
+++ b/bzrlib/transform.py	2007-11-26 19:54:09 +0000
@@ -1641,7 +1641,8 @@
         pp.next_phase()
         child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
         try:
-            raw_conflicts = resolve_conflicts(tt, child_pb)
+            raw_conflicts = resolve_conflicts(tt, child_pb,
+                lambda t, c: conflict_pass(t, c, target_tree))
         finally:
             child_pb.finished()
         conflicts = cook_conflicts(raw_conflicts, tt)
@@ -1817,10 +1818,11 @@
                 try:
                     tt.final_name(trans_id)
                 except NoFinalPath:
-                    file_id = tt.final_file_id(trans_id)
-                    entry = path_tree.inventory[file_id]
-                    parent_trans_id = tt.trans_id_file_id(entry.parent_id)
-                    tt.adjust_path(entry.name, parent_trans_id, trans_id)
+                    if path_tree is not None:
+                        file_id = tt.final_file_id(trans_id)
+                        entry = path_tree.inventory[file_id]
+                        parent_trans_id = tt.trans_id_file_id(entry.parent_id)
+                        tt.adjust_path(entry.name, parent_trans_id, trans_id)
         elif c_type == 'unversioned parent':
             tt.version_file(tt.inactive_file_id(conflict[1]), conflict[1])
             new_conflicts.add((c_type, 'Versioned directory', conflict[1]))




More information about the bazaar-commits mailing list