Rev 3235: Add hardlink support to checkout and branch (abentley) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sun Feb 24 19:15:30 GMT 2008


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

------------------------------------------------------------
revno: 3235
revision-id:pqm at pqm.ubuntu.com-20080224191521-mrdhiyn59r5q2z6l
parent: pqm at pqm.ubuntu.com-20080224013817-4ps9nmrzjtg9ugtz
parent: aaron at aaronbentley.com-20080224174002-6lszpitwftf99byi
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sun 2008-02-24 19:15:21 +0000
message:
  Add hardlink support to checkout and branch (abentley)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
  bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
  bzrlib/tests/blackbox/test_checkout.py test_checkout.py-20060211231752-a5cde67cf70af854
  bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
  bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
  bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 3136.1.11
    revision-id:aaron at aaronbentley.com-20080224174002-6lszpitwftf99byi
    parent: aaron at aaronbentley.com-20080224171956-0qu73pf4pol2utu4
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: hardlinks2
    timestamp: Sun 2008-02-24 12:40:02 -0500
    message:
      Updates from review
    modified:
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 3136.1.10
    revision-id:aaron at aaronbentley.com-20080224171956-0qu73pf4pol2utu4
    parent: aaron at aaronbentley.com-20080224164446-inrognyno8lghkzz
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: hardlinks2
    timestamp: Sun 2008-02-24 12:19:56 -0500
    message:
      Clean error if filesystem does not support hard-links
    modified:
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 3136.1.9
    revision-id:aaron at aaronbentley.com-20080224164446-inrognyno8lghkzz
    parent: aaron at aaronbentley.com-20080224164213-eza1lzru5bwuwmmj
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: hardlinks2
    timestamp: Sun 2008-02-24 11:44:46 -0500
    message:
      Move NEWS entry
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3136.1.8
    revision-id:aaron at aaronbentley.com-20080224164213-eza1lzru5bwuwmmj
    parent: abentley at panoramicfeedback.com-20071221153251-prgilpbjkdif3265
    parent: pqm at pqm.ubuntu.com-20080224013817-4ps9nmrzjtg9ugtz
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: hardlinks2
    timestamp: Sun 2008-02-24 11:42:13 -0500
    message:
      Merge with bzr.dev
    removed:
      bzrlib/plugins/multiparent.py  mpregen-20070411063203-5x9z7i73add0d6f6-1
      index.txt                      index.txt-20071121073725-0corxykv5irjal00-1
    added:
      bzrlib/tests/repository_implementations/test_has_revisions.py test_has_revisions.p-20080111035443-xaupgdsx5fw1q54b-1
      bzrlib/tests/test_http_implementations.py test_http_implementa-20071218210003-65nh81gglcfvurw6-1
      contrib/bzr_access             bzr_access-20071210163004-c9lb1renhra2ncg0-1
      doc/developers/development-repo.txt developmentrepo.txt-20080102200205-raj42k61dch8pjmj-1
      doc/developers/inventory.txt   inventory.txt-20080103013957-opkrhxy6lmywmx4i-1
      doc/developers/lca-merge.txt   lcamerge.txt-20080103061803-9isydn4ivgwrvorw-1
      doc/en/tutorials/using_bazaar_with_launchpad.txt using_bazaar_with_lp-20071211073140-7msh8uf9a9h4y9hb-1
      doc/en/user-guide/revnos.txt   revnos.txt-20080111231928-pbntxea0ynh9ww1t-1
      tools/package_mf.py            package_mf.py-20080206141953-323gd0qb2z3tn5pc-1
    renamed:
      bzrlib/tests/HTTPTestUtil.py => bzrlib/tests/http_utils.py HTTPTestUtil.py-20050914180604-247d3aafb7a43343
      bzrlib/tests/HttpServer.py => bzrlib/tests/http_server.py httpserver.py-20061012142527-m1yxdj1xazsf8d7s-1
    modified:
      .bzrignore                     bzrignore-20050311232317-81f7b71efa2db11a
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      README                         README-20050309040720-8f368abf9f346b9d
      bzr                            bzr.py-20050313053754-5485f144c7006fa6
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/annotate.py             annotate.py-20050922133147-7c60541d2614f022
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bundle/commands.py      __init__.py-20050617152058-1b6530d9ab85c11c
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
      bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
      bzrlib/conflicts.py            conflicts.py-20051001061850-78ef952ba63d2b42
      bzrlib/debug.py                debug.py-20061102062349-vdhrw9qdpck8cl35-1
      bzrlib/delta.py                delta.py-20050729221636-54cf14ef94783d0a
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
      bzrlib/doc/api/__init__.py     __init__.py-20051224020744-7b87d590843855bc
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/help_topics/en/conflicts.txt conflicts.txt-20070723221841-ns3jvwxdb4okn6fk-1
      bzrlib/info.py                 info.py-20050323235939-6bbfe7d9700b0b9b
      bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/option.py               option.py-20051014052914-661fb36e76e7362f
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
      bzrlib/plugins/launchpad/__init__.py __init__.py-20060315182712-2d5feebd2a1032dc
      bzrlib/plugins/launchpad/lp_indirect.py lp_indirect.py-20070126012204-de5rugwlt22c7u7e-1
      bzrlib/plugins/launchpad/lp_registration.py lp_registration.py-20060315190948-daa617eafe3a8d48
      bzrlib/plugins/launchpad/test_lp_indirect.py test_lp_indirect.py-20070126002743-oyle362tzv9cd8mi-1
      bzrlib/plugins/launchpad/test_register.py test_register.py-20060315182712-40f5dda945c829a8
      bzrlib/progress.py             progress.py-20050610070202-df9faaab791964c0
      bzrlib/reconfigure.py          reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
      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/repofmt/weaverepo.py    presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/revisiontree.py         revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
      bzrlib/smart/bzrdir.py         bzrdir.py-20061122024551-ol0l0o0oofsu9b3t-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/smart/vfs.py            vfs.py-20061108095550-gunadhxmzkdjfeek-2
      bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
      bzrlib/symbol_versioning.py    symbol_versioning.py-20060105104851-9ecf8af605d15a80
      bzrlib/tests/TestUtil.py       TestUtil.py-20050824080200-5f70140a2d938694
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_annotate.py testannotate.py-20051013044000-457f44801bfa9d39
      bzrlib/tests/blackbox/test_bundle_info.py test_bundle_info.py-20070816181255-eiuodwxuqu7w7gxf-1
      bzrlib/tests/blackbox/test_diff.py test_diff.py-20060110203741-aa99ac93e633d971
      bzrlib/tests/blackbox/test_ignore.py test_ignore.py-20060703063225-4tm8dc2pa7wwg2t3-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/blackbox/test_outside_wt.py test_outside_wt.py-20060116200058-98edd33e7db8bdde
      bzrlib/tests/blackbox/test_pull.py test_pull.py-20051201144907-64959364f629947f
      bzrlib/tests/blackbox/test_selftest.py test_selftest.py-20060123024542-01c5f1bbcb596d78
      bzrlib/tests/blackbox/test_too_much.py blackbox.py-20050620052131-a7370d756399f615
      bzrlib/tests/blackbox/test_upgrade.py test_upgrade.py-20060120060132-b41e5ed2f886ad28
      bzrlib/tests/blackbox/test_version.py test_version.py-20070312060045-ol7th9z035r3im3d-1
      bzrlib/tests/blackbox/test_version_info.py test_bb_version_info.py-20051228204928-91711c6559d952f7
      bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
      bzrlib/tests/branch_implementations/test_http.py test_http.py-20060731224648-2eef7ae5yja95rya-1
      bzrlib/tests/branch_implementations/test_parent.py test_parent.py-20050830052751-5e62766623c32222
      bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
      bzrlib/tests/inventory_implementations/__init__.py __init__.py-20070821044532-olbadbokgv3qv1yd-1
      bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
      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_bundle.py    test.py-20050630184834-092aa401ab9f039c
      bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
      bzrlib/tests/test_commit.py    test_commit.py-20050914060732-279f057f8c295434
      bzrlib/tests/test_conflicts.py test_conflicts.py-20051006031059-e2dad9bbeaa5891f
      bzrlib/tests/test_diff.py      testdiff.py-20050727164403-d1a3496ebb12e339
      bzrlib/tests/test_dirstate.py  test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
      bzrlib/tests/test_http_response.py test_http_response.py-20060628233143-950b2a482a32505d
      bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-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_nonascii.py  testnonascii.py-20051018022645-ea1d8b6477b058a6
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
      bzrlib/tests/test_progress.py  test_progress.py-20060308160359-978c397bc79b7fda
      bzrlib/tests/test_reconfigure.py test_reconfigure.py-20070908040425-6ykgo7escxhyrg9p-2
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
      bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
      bzrlib/tests/test_revert.py    test_revert.py-20060828180832-fqb1v6ecpyvnlitj-1
      bzrlib/tests/test_revisionnamespaces.py testrevisionnamespaces.py-20050711050225-8b4af89e6b1efe84
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/test_sftp_transport.py testsftp.py-20051027032739-247570325fec7e7e
      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_ssh_transport.py test_ssh_transport.p-20070105153201-f7iq2bosvgjbdgc3-1
      bzrlib/tests/test_trace.py     testtrace.py-20051110225523-a21117fc7a07eeff
      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_tsort.py     testtsort.py-20051025073946-27da871c394d5be4
      bzrlib/tests/test_urlutils.py  test_urlutils.py-20060502192900-46b1f9579987cf9c
      bzrlib/tests/test_version_info.py test_version_info.py-20051228204928-2c364e30b702b41b
      bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
      bzrlib/tests/test_win32utils.py test_win32utils.py-20070713181630-8xsrjymd3e8mgw23-108
      bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
      bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
      bzrlib/tests/workingtree_implementations/test_rename_one.py test_rename_one.py-20070226161242-2d8ibdedl700jgio-1
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
      bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
      bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
      bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
      bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
      bzrlib/transport/http/response.py _response.py-20060613154423-a2ci7hd4iw5c7fnt-1
      bzrlib/transport/memory.py     memory.py-20051016101338-cd008dbdf69f04fc
      bzrlib/transport/remote.py     ssh.py-20060608202016-c25gvf1ob7ypbus6-1
      bzrlib/transport/ssh.py        ssh.py-20060824042150-0s9787kng6zv1nwq-1
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      bzrlib/tsort.py                tsort.py-20051025073946-7808f6aaf7d07208
      bzrlib/urlutils.py             urlutils.py-20060502195429-e8a161ecf8fac004
      bzrlib/version_info_formats/__init__.py generate_version_info.py-20051228204928-8358edabcddcd97e
      bzrlib/version_info_formats/format_custom.py format_custom.py-20071029100350-ajovqhbpb5khf6gu-1
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      bzrlib/xml_serializer.py       xml.py-20050309040759-57d51586fdec365d
      doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
      doc/developers/index.txt       index.txt-20070508041241-qznziunkg0nffhiw-1
      doc/en/user-guide/bug_trackers.txt bug_trackers.txt-20070713223459-khxdlcudraii95uv-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
      doc/index.txt                  index.txt-20070813101924-07gd9i9d2jt124bf-1
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
      tools/rst2html.py              rst2html.py-20060817120932-gn177u8v0008txhu-1
      tools/win32/bzr.iss.cog        bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
      bzrlib/tests/http_utils.py     HTTPTestUtil.py-20050914180604-247d3aafb7a43343
      bzrlib/tests/http_server.py    httpserver.py-20061012142527-m1yxdj1xazsf8d7s-1
    ------------------------------------------------------------
    revno: 3136.1.7
    revision-id:abentley at panoramicfeedback.com-20071221153251-prgilpbjkdif3265
    parent: aaron.bentley at utoronto.ca-20071221065648-so15wllqktbs8cp4
    parent: pqm at pqm.ubuntu.com-20071221145325-erktp9le86ik56j1
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: hardlinks2
    timestamp: Fri 2007-12-21 10:32:51 -0500
    message:
      Merge with bzr.dev
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
    ------------------------------------------------------------
    revno: 3136.1.6
    revision-id:aaron.bentley at utoronto.ca-20071221065648-so15wllqktbs8cp4
    parent: abentley at panoramicfeedback.com-20071220211242-ofgviijwgtgivg90
    parent: aaron.bentley at utoronto.ca-20071221041231-q2l480o2twqvayj5
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: hardlinks2
    timestamp: Fri 2007-12-21 01:56:48 -0500
    message:
      Merge path-handling fix
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
      bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
      bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
      bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
    ------------------------------------------------------------
    revno: 3136.1.5
    revision-id:abentley at panoramicfeedback.com-20071220211242-ofgviijwgtgivg90
    parent: abentley at panoramicfeedback.com-20071220210219-bkf081e3t9ubkszq
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: hardlinks2
    timestamp: Thu 2007-12-20 16:12:42 -0500
    message:
      Fix sample workingtree format
    modified:
      bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
    ------------------------------------------------------------
    revno: 3136.1.4
    revision-id:abentley at panoramicfeedback.com-20071220210219-bkf081e3t9ubkszq
    parent: abentley at panoramicfeedback.com-20071220204445-9o2f10gvvd8e4rks
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: hardlinks2
    timestamp: Thu 2007-12-20 16:02:19 -0500
    message:
      Avoid id2abspath calls
    modified:
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 3136.1.3
    revision-id:abentley at panoramicfeedback.com-20071220204445-9o2f10gvvd8e4rks
    parent: abentley at panoramicfeedback.com-20071220201922-r6a2vsx612x87yf6
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: hardlinks2
    timestamp: Thu 2007-12-20 15:44:45 -0500
    message:
      Implement hard-link support for branch and checkout
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
      bzrlib/tests/blackbox/test_checkout.py test_checkout.py-20060211231752-a5cde67cf70af854
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 3136.1.2
    revision-id:abentley at panoramicfeedback.com-20071220201922-r6a2vsx612x87yf6
    parent: abentley at panoramicfeedback.com-20071220191602-q1p5o3svshujfodd
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: hardlinks2
    timestamp: Thu 2007-12-20 15:19:22 -0500
    message:
      Implement hard-linking for build_tree
    modified:
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 3136.1.1
    revision-id:abentley at panoramicfeedback.com-20071220191602-q1p5o3svshujfodd
    parent: pqm at pqm.ubuntu.com-20071220173454-9nqwgm3k66f4bmj8
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: hardlinks2
    timestamp: Thu 2007-12-20 14:16:02 -0500
    message:
      Add support for hardlinks to TreeTransform
    modified:
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
=== modified file 'NEWS'
--- a/NEWS	2008-02-24 00:00:13 +0000
+++ b/NEWS	2008-02-24 16:44:46 +0000
@@ -33,6 +33,9 @@
 
   FEATURES:
 
+   * ``branch`` and ``checkout`` can hard-link working tree files, which is
+     faster and saves space.  (Aaron Bentley)
+
   IMPROVEMENTS:
 
   BUGFIXES:

=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2008-02-06 04:06:42 +0000
+++ b/bzrlib/branch.py	2008-02-24 16:42:13 +0000
@@ -753,7 +753,8 @@
         return format
 
     def create_checkout(self, to_location, revision_id=None,
-                        lightweight=False, accelerator_tree=None):
+                        lightweight=False, accelerator_tree=None,
+                        hardlink=False):
         """Create a checkout of a branch.
         
         :param to_location: The url to produce the checkout at
@@ -764,6 +765,8 @@
             contents more quickly than the revision tree, i.e. a workingtree.
             The revision tree will be used for cases where accelerator_tree's
             content is different.
+        :param hardlink: If true, hard-link files from accelerator_tree,
+            where possible.
         :return: The tree of the created checkout
         """
         t = transport.get_transport(to_location)
@@ -784,7 +787,8 @@
             from_branch=None
         tree = checkout.create_workingtree(revision_id,
                                            from_branch=from_branch,
-                                           accelerator_tree=accelerator_tree)
+                                           accelerator_tree=accelerator_tree,
+                                           hardlink=hardlink)
         basis_tree = tree.basis_tree()
         basis_tree.lock_read()
         try:

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2008-02-01 00:30:33 +0000
+++ b/bzrlib/builtins.py	2008-02-24 16:42:13 +0000
@@ -864,10 +864,12 @@
 
     _see_also = ['checkout']
     takes_args = ['from_location', 'to_location?']
-    takes_options = ['revision']
+    takes_options = ['revision', Option('hardlink',
+        help='Hard-link working tree files where possible.')]
     aliases = ['get', 'clone']
 
-    def run(self, from_location, to_location=None, revision=None):
+    def run(self, from_location, to_location=None, revision=None,
+            hardlink=False):
         from bzrlib.tag import _merge_tags_if_possible
         if revision is None:
             revision = [None]
@@ -905,7 +907,8 @@
                 # preserve whatever source format we have.
                 dir = br_from.bzrdir.sprout(to_transport.base, revision_id,
                                             possible_transports=[to_transport],
-                                            accelerator_tree=accelerator_tree)
+                                            accelerator_tree=accelerator_tree,
+                                            hardlink=hardlink)
                 branch = dir.open_branch()
             except errors.NoSuchRevision:
                 to_transport.delete_tree('.')
@@ -950,13 +953,16 @@
                                  "common operations like diff and status without "
                                  "such access, and also support local commits."
                             ),
-                     Option('files-from',
-                            help="Get file contents from this tree.", type=str)
+                     Option('files-from', type=str,
+                            help="Get file contents from this tree."),
+                     Option('hardlink',
+                            help='Hard-link working tree files where possible.'
+                            ),
                      ]
     aliases = ['co']
 
     def run(self, branch_location=None, to_location=None, revision=None,
-            lightweight=False, files_from=None):
+            lightweight=False, files_from=None, hardlink=False):
         if revision is None:
             revision = [None]
         elif len(revision) > 1:
@@ -987,7 +993,7 @@
                 source.bzrdir.create_workingtree(revision_id)
                 return
         source.create_checkout(to_location, revision_id, lightweight,
-                               accelerator_tree)
+                               accelerator_tree, hardlink)
 
 
 class cmd_renames(Command):

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2008-02-13 22:11:40 +0000
+++ b/bzrlib/bzrdir.py	2008-02-24 16:42:13 +0000
@@ -456,7 +456,7 @@
         return bzrdir.create_workingtree()
 
     def create_workingtree(self, revision_id=None, from_branch=None,
-        accelerator_tree=None):
+        accelerator_tree=None, hardlink=False):
         """Create a working tree at this BzrDir.
         
         :param revision_id: create it as of this revision id.
@@ -890,7 +890,7 @@
 
     def sprout(self, url, revision_id=None, force_new_repo=False,
                recurse='down', possible_transports=None,
-               accelerator_tree=None):
+               accelerator_tree=None, hardlink=False):
         """Create a copy of this bzrdir prepared for use as a new line of
         development.
 
@@ -907,6 +907,8 @@
             contents more quickly than the revision tree, i.e. a workingtree.
             The revision tree will be used for cases where accelerator_tree's
             content is different.
+        :param hardlink: If true, hard-link files from accelerator_tree,
+            where possible.
         """
         target_transport = get_transport(url, possible_transports)
         target_transport.ensure_base()
@@ -951,7 +953,8 @@
             result.create_branch()
         if isinstance(target_transport, LocalTransport) and (
             result_repo is None or result_repo.make_working_trees()):
-            wt = result.create_workingtree(accelerator_tree=accelerator_tree)
+            wt = result.create_workingtree(accelerator_tree=accelerator_tree,
+                hardlink=hardlink)
             wt.lock_write()
             try:
                 if wt.path2id('') is None:
@@ -1046,7 +1049,7 @@
         raise errors.UnsupportedOperation(self.destroy_repository, self)
 
     def create_workingtree(self, revision_id=None, from_branch=None,
-                           accelerator_tree=None):
+                           accelerator_tree=None, hardlink=False):
         """See BzrDir.create_workingtree."""
         # this looks buggy but is not -really-
         # because this format creates the workingtree when the bzrdir is
@@ -1120,7 +1123,8 @@
         return format.open(self, _found=True)
 
     def sprout(self, url, revision_id=None, force_new_repo=False,
-               possible_transports=None, accelerator_tree=None):
+               possible_transports=None, accelerator_tree=None,
+               hardlink=False):
         """See BzrDir.sprout()."""
         from bzrlib.workingtree import WorkingTreeFormat2
         self._make_tail(url)
@@ -1135,7 +1139,8 @@
             pass
         # we always want a working tree
         WorkingTreeFormat2().initialize(result,
-                                        accelerator_tree=accelerator_tree)
+                                        accelerator_tree=accelerator_tree,
+                                        hardlink=hardlink)
         return result
 
 
@@ -1230,11 +1235,11 @@
         self.transport.delete_tree('repository')
 
     def create_workingtree(self, revision_id=None, from_branch=None,
-                           accelerator_tree=None):
+                           accelerator_tree=None, hardlink=False):
         """See BzrDir.create_workingtree."""
         return self._format.workingtree_format.initialize(
             self, revision_id, from_branch=from_branch,
-            accelerator_tree=accelerator_tree)
+            accelerator_tree=accelerator_tree, hardlink=hardlink)
 
     def destroy_workingtree(self):
         """See BzrDir.destroy_workingtree."""

=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2008-02-12 02:13:43 +0000
+++ b/bzrlib/errors.py	2008-02-24 17:19:56 +0000
@@ -509,6 +509,11 @@
     _fmt = 'Directory not empty: "%(path)s"%(extra)s'
 
 
+class HardLinkNotSupported(PathError):
+
+    _fmt = 'Hard-linking "%(path)s" is not supported'
+
+
 class ReadingCompleted(InternalBzrError):
     
     _fmt = ("The MediumRequest '%(request)s' has already had finish_reading "

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2008-01-28 16:59:52 +0000
+++ b/bzrlib/osutils.py	2008-02-24 16:42:13 +0000
@@ -849,6 +849,13 @@
         return False
 
 
+def has_hardlinks():
+    if getattr(os, 'link', None) is not None:
+        return True
+    else:
+        return False
+
+
 def contains_whitespace(s):
     """True if there are any whitespace characters in s."""
     # string.whitespace can include '\xa0' in certain locales, because it is

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2008-02-16 10:03:17 +0000
+++ b/bzrlib/tests/__init__.py	2008-02-24 16:42:13 +0000
@@ -2970,6 +2970,17 @@
 SymlinkFeature = _SymlinkFeature()
 
 
+class _HardlinkFeature(Feature):
+
+    def _probe(self):
+        return osutils.has_hardlinks()
+
+    def feature_name(self):
+        return 'hardlinks'
+
+HardlinkFeature = _HardlinkFeature()
+
+
 class _OsFifoFeature(Feature):
 
     def _probe(self):

=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py	2007-08-03 12:59:14 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py	2007-12-20 20:44:45 +0000
@@ -22,6 +22,7 @@
 from bzrlib import branch, bzrdir
 from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1
 from bzrlib.tests.blackbox import ExternalBase
+from bzrlib.tests import HardlinkFeature
 from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
 from bzrlib.workingtree import WorkingTree
 
@@ -84,6 +85,17 @@
         self.assertFalse(pushed_repo.has_revision('a-2'))
         self.assertTrue(pushed_repo.has_revision('b-1'))
 
+    def test_branch_hardlink(self):
+        self.requireFeature(HardlinkFeature)
+        source = self.make_branch_and_tree('source')
+        self.build_tree(['source/file1'])
+        source.add('file1')
+        source.commit('added file')
+        self.run_bzr(['branch', 'source', 'target', '--hardlink'])
+        source_stat = os.stat('source/file1')
+        target_stat = os.stat('target/file1')
+        self.assertEqual(source_stat, target_stat)
+
 
 class TestRemoteBranch(TestCaseWithSFTPServer):
 

=== modified file 'bzrlib/tests/blackbox/test_checkout.py'
--- a/bzrlib/tests/blackbox/test_checkout.py	2007-12-18 23:12:06 +0000
+++ b/bzrlib/tests/blackbox/test_checkout.py	2007-12-20 20:44:45 +0000
@@ -29,6 +29,7 @@
     workingtree,
     )
 from bzrlib.tests.blackbox import ExternalBase
+from bzrlib.tests import HardlinkFeature
 
 
 class TestCheckout(ExternalBase):
@@ -142,3 +143,15 @@
         branch = _mod_branch.Branch.open('branch')
         self.run_bzr(['checkout', 'branch', 'branch2', '--files-from',
                       'branch'])
+
+    def test_checkout_hardlink(self):
+        self.requireFeature(HardlinkFeature)
+        source = self.make_branch_and_tree('source')
+        self.build_tree(['source/file1'])
+        source.add('file1')
+        source.commit('added file')
+        self.run_bzr(['checkout', 'source', 'target', '--files-from', 'source',
+                      '--hardlink'])
+        source_stat = os.stat('source/file1')
+        target_stat = os.stat('target/file1')
+        self.assertEqual(source_stat, target_stat)

=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py	2008-02-22 00:52:31 +0000
+++ b/bzrlib/tests/test_transform.py	2008-02-24 16:42:13 +0000
@@ -43,6 +43,7 @@
 from bzrlib.merge import Merge3Merger
 from bzrlib.tests import (
     CaseInsensitiveFilesystemFeature,
+    HardlinkFeature,
     SymlinkFeature,
     TestCase,
     TestCaseInTempDir,
@@ -134,6 +135,21 @@
         transform.finalize()
         transform.finalize()
 
+    def test_hardlink(self):
+        self.requireFeature(HardlinkFeature)
+        transform, root = self.get_transform()
+        transform.new_file('file1', root, 'contents')
+        transform.apply()
+        target = self.make_branch_and_tree('target')
+        target_transform = TreeTransform(target)
+        trans_id = target_transform.create_path('file1', target_transform.root)
+        target_transform.create_hardlink(self.wt.abspath('file1'), trans_id)
+        target_transform.apply()
+        self.failUnlessExists('target/file1')
+        source_stat = os.stat(self.wt.abspath('file1'))
+        target_stat = os.stat('target/file1')
+        self.assertEqual(source_stat, target_stat)
+
     def test_convenience(self):
         transform, root = self.get_transform()
         self.wt.lock_tree_write()
@@ -1573,12 +1589,19 @@
         # children of non-root directories should not be renamed
         self.assertEqual(2, transform_result.rename_count)
 
+    def create_ab_tree(self):
+        """Create a committed test tree with two files"""
+        source = self.make_branch_and_tree('source')
+        self.build_tree_contents([('source/file1', 'A')])
+        self.build_tree_contents([('source/file2', 'B')])
+        source.add(['file1', 'file2'], ['file1-id', 'file2-id'])
+        source.commit('commit files')
+        source.lock_write()
+        self.addCleanup(source.unlock)
+        return source
+
     def test_build_tree_accelerator_tree(self):
-        source = self.make_branch_and_tree('source')
-        self.build_tree_contents([('source/file1', 'A')])
-        self.build_tree_contents([('source/file2', 'B')])
-        source.add(['file1', 'file2'], ['file1-id', 'file2-id'])
-        source.commit('commit files')
+        source = self.create_ab_tree()
         self.build_tree_contents([('source/file2', 'C')])
         calls = []
         real_source_get_file = source.get_file
@@ -1586,8 +1609,6 @@
             calls.append(file_id)
             return real_source_get_file(file_id, path)
         source.get_file = get_file
-        source.lock_read()
-        self.addCleanup(source.unlock)
         target = self.make_branch_and_tree('target')
         revision_tree = source.basis_tree()
         revision_tree.lock_read()
@@ -1599,11 +1620,7 @@
         self.assertEqual([], list(target._iter_changes(revision_tree)))
 
     def test_build_tree_accelerator_tree_missing_file(self):
-        source = self.make_branch_and_tree('source')
-        self.build_tree_contents([('source/file1', 'A')])
-        self.build_tree_contents([('source/file2', 'B')])
-        source.add(['file1', 'file2'])
-        source.commit('commit files')
+        source = self.create_ab_tree()
         os.unlink('source/file1')
         source.remove(['file2'])
         target = self.make_branch_and_tree('target')
@@ -1632,8 +1649,6 @@
             calls.append(file_id)
             return real_source_get_file(file_id, path)
         source.get_file = get_file
-        source.lock_read()
-        self.addCleanup(source.unlock)
         target = self.make_branch_and_tree('target')
         revision_tree = source.basis_tree()
         revision_tree.lock_read()
@@ -1644,6 +1659,31 @@
         self.addCleanup(target.unlock)
         self.assertEqual([], list(target._iter_changes(revision_tree)))
 
+    def test_build_tree_hardlink(self):
+        self.requireFeature(HardlinkFeature)
+        source = self.create_ab_tree()
+        target = self.make_branch_and_tree('target')
+        revision_tree = source.basis_tree()
+        revision_tree.lock_read()
+        self.addCleanup(revision_tree.unlock)
+        build_tree(revision_tree, target, source, hardlink=True)
+        target.lock_read()
+        self.addCleanup(target.unlock)
+        self.assertEqual([], list(target._iter_changes(revision_tree)))
+        source_stat = os.stat('source/file1')
+        target_stat = os.stat('target/file1')
+        self.assertEqual(source_stat, target_stat)
+
+        # Explicitly disallowing hardlinks should prevent them.
+        target2 = self.make_branch_and_tree('target2')
+        build_tree(revision_tree, target2, source, hardlink=False)
+        target2.lock_read()
+        self.addCleanup(target2.unlock)
+        self.assertEqual([], list(target2._iter_changes(revision_tree)))
+        source_stat = os.stat('source/file1')
+        target2_stat = os.stat('target2/file1')
+        self.assertNotEqual(source_stat, target2_stat)
+
     def test_build_tree_accelerator_tree_moved(self):
         source = self.make_branch_and_tree('source')
         self.build_tree_contents([('source/file1', 'A')])
@@ -1661,6 +1701,24 @@
         self.addCleanup(target.unlock)
         self.assertEqual([], list(target._iter_changes(revision_tree)))
 
+    def test_build_tree_hardlinks_preserve_execute(self):
+        self.requireFeature(HardlinkFeature)
+        source = self.create_ab_tree()
+        tt = TreeTransform(source)
+        trans_id = tt.trans_id_tree_file_id('file1-id')
+        tt.set_executability(True, trans_id)
+        tt.apply()
+        self.assertTrue(source.is_executable('file1-id'))
+        target = self.make_branch_and_tree('target')
+        revision_tree = source.basis_tree()
+        revision_tree.lock_read()
+        self.addCleanup(revision_tree.unlock)
+        build_tree(revision_tree, target, source, hardlink=True)
+        target.lock_read()
+        self.addCleanup(target.unlock)
+        self.assertEqual([], list(target._iter_changes(revision_tree)))
+        self.assertTrue(source.is_executable('file1-id'))
+
 
 class MockTransform(object):
 

=== modified file 'bzrlib/tests/test_workingtree.py'
--- a/bzrlib/tests/test_workingtree.py	2007-12-21 20:47:27 +0000
+++ b/bzrlib/tests/test_workingtree.py	2008-02-24 16:42:13 +0000
@@ -95,7 +95,7 @@
         return "Sample tree format."
 
     def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
-                   accelerator_tree=None):
+                   accelerator_tree=None, hardlink=False):
         """Sample branches cannot be created."""
         t = a_bzrdir.get_workingtree_transport(self)
         t.put_bytes('format', self.get_format_string())

=== modified file 'bzrlib/tests/workingtree_implementations/test_workingtree.py'
--- a/bzrlib/tests/workingtree_implementations/test_workingtree.py	2007-11-28 21:04:08 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_workingtree.py	2008-02-24 17:19:56 +0000
@@ -17,6 +17,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 from cStringIO import StringIO
+import errno
 import os
 import sys
 
@@ -863,3 +864,24 @@
         if tree.__class__ == WorkingTree2:
             raise TestSkipped('WorkingTree2 is not supported')
         self.assertEqual(case_sensitive, tree.case_sensitive)
+
+    def test_sprout_hardlink(self):
+        source = self.make_branch_and_tree('source')
+        self.build_tree(['source/file'])
+        source.add('file')
+        source.commit('added file')
+        def fake_link(source, target):
+            raise OSError(errno.EPERM, 'Operation not permitted')
+        real_os_link = os.link
+        os.link = fake_link
+        try:
+            # Hard-link support is optional, so supplying hardlink=True may
+            # or may not raise an exception.  But if it does, it must be
+            # HardLinkNotSupported
+            try:
+                source.bzrdir.sprout('target', accelerator_tree=source,
+                                     hardlink=True)
+            except errors.HardLinkNotSupported:
+                pass
+        finally:
+            os.link = real_os_link

=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2008-02-22 00:39:00 +0000
+++ b/bzrlib/transform.py	2008-02-24 17:40:02 +0000
@@ -354,6 +354,23 @@
         if typefunc(mode):
             os.chmod(self._limbo_name(trans_id), mode)
 
+    def create_hardlink(self, path, trans_id):
+        """Schedule creation of a hard link"""
+        name = self._limbo_name(trans_id)
+        try:
+            os.link(path, name)
+        except OSError, e:
+            if e.errno != errno.EPERM:
+                raise
+            raise errors.HardLinkNotSupported(path)
+        try:
+            unique_add(self._new_contents, trans_id, 'file')
+        except:
+            # Clean up the file, it never got registered so
+            # TreeTransform.finalize() won't clean it up.
+            os.unlink(name)
+            raise
+
     def create_directory(self, trans_id):
         """Schedule creation of a new directory.
         
@@ -1461,7 +1478,7 @@
     return file_ids
 
 
-def build_tree(tree, wt, accelerator_tree=None):
+def build_tree(tree, wt, accelerator_tree=None, hardlink=False):
     """Create working tree for a branch, using a TreeTransform.
     
     This function should be used on empty trees, having a tree root at most.
@@ -1480,6 +1497,9 @@
     :param accelerator_tree: A tree which can be used for retrieving file
         contents more quickly than tree itself, i.e. a workingtree.  tree
         will be used for cases where accelerator_tree's content is different.
+    :param hardlink: If true, hard-link files to accelerator_tree, where
+        possible.  accelerator_tree must implement abspath, i.e. be a
+        working tree.
     """
     wt.lock_tree_write()
     try:
@@ -1488,7 +1508,7 @@
             if accelerator_tree is not None:
                 accelerator_tree.lock_read()
             try:
-                return _build_tree(tree, wt, accelerator_tree)
+                return _build_tree(tree, wt, accelerator_tree, hardlink)
             finally:
                 if accelerator_tree is not None:
                     accelerator_tree.unlock()
@@ -1498,7 +1518,7 @@
         wt.unlock()
 
 
-def _build_tree(tree, wt, accelerator_tree):
+def _build_tree(tree, wt, accelerator_tree, hardlink):
     """See build_tree."""
     if len(wt.inventory) > 1:  # more than just a root
         raise errors.WorkingTreeAlreadyPopulated(base=wt.basedir)
@@ -1525,6 +1545,7 @@
         pb = bzrlib.ui.ui_factory.nested_progress_bar()
         try:
             deferred_contents = []
+            num = 0
             for num, (tree_path, entry) in \
                 enumerate(tree.inventory.iter_entries_by_dir()):
                 pb.update("Building tree", num - len(deferred_contents),
@@ -1574,13 +1595,9 @@
                     new_trans_id = file_trans_id[file_id]
                     old_parent = tt.trans_id_tree_path(tree_path)
                     _reparent_children(tt, old_parent, new_trans_id)
-            for num, (trans_id, bytes) in enumerate(
-                _iter_files_bytes_accelerated(tree, accelerator_tree,
-                                              deferred_contents)):
-                tt.create_file(bytes, trans_id)
-                pb.update('Adding file contents',
-                          (num + len(tree.inventory) - len(deferred_contents)),
-                          len(tree.inventory))
+            offset = num + 1 - len(deferred_contents)
+            _create_files(tt, tree, deferred_contents, pb, offset,
+                          accelerator_tree, hardlink)
         finally:
             pb.finished()
         pp.next_phase()
@@ -1601,28 +1618,38 @@
     return result
 
 
-def _iter_files_bytes_accelerated(tree, accelerator_tree, desired_files):
+def _create_files(tt, tree, desired_files, pb, offset, accelerator_tree,
+                  hardlink):
+    total = len(desired_files) + offset
     if accelerator_tree is None:
         new_desired_files = desired_files
     else:
         iter = accelerator_tree._iter_changes(tree, include_unchanged=True)
         unchanged = dict((f, p[1]) for (f, p, c, v, d, n, k, e)
-                         in iter if not c)
+                         in iter if not (c or e[0] != e[1]))
         new_desired_files = []
-        for file_id, identifier in desired_files:
+        count = 0
+        for file_id, trans_id in desired_files:
             accelerator_path = unchanged.get(file_id)
             if accelerator_path is None:
-                new_desired_files.append((file_id, identifier))
+                new_desired_files.append((file_id, trans_id))
                 continue
-            contents = accelerator_tree.get_file(file_id, accelerator_path)
-            try:
-                want_new = False
-                contents_bytes = (contents.read(),)
-            finally:
-                contents.close()
-            yield identifier, contents_bytes
-    for result in tree.iter_files_bytes(new_desired_files):
-        yield result
+            pb.update('Adding file contents', count + offset, total)
+            if hardlink:
+                tt.create_hardlink(accelerator_tree.abspath(accelerator_path),
+                                   trans_id)
+            else:
+                contents = accelerator_tree.get_file(file_id, accelerator_path)
+                try:
+                    tt.create_file(contents, trans_id)
+                finally:
+                    contents.close()
+            count += 1
+        offset += count
+    for count, (trans_id, contents) in enumerate(tree.iter_files_bytes(
+                                                 new_desired_files)):
+        tt.create_file(contents, trans_id)
+        pb.update('Adding file contents', count + offset, total)
 
 
 def _reparent_children(tt, old_parent, new_parent):

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2007-12-21 20:47:27 +0000
+++ b/bzrlib/workingtree.py	2008-02-24 16:42:13 +0000
@@ -2763,7 +2763,7 @@
         
 
     def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
-                   accelerator_tree=None):
+                   accelerator_tree=None, hardlink=False):
         """See WorkingTreeFormat.initialize()."""
         if not isinstance(a_bzrdir.transport, LocalTransport):
             raise errors.NotLocalUrl(a_bzrdir.transport.base)
@@ -2856,7 +2856,7 @@
                              self._lock_class)
 
     def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
-                   accelerator_tree=None):
+                   accelerator_tree=None, hardlink=False):
         """See WorkingTreeFormat.initialize().
         
         :param revision_id: if supplied, create a working tree at a different
@@ -2865,6 +2865,8 @@
             contents more quickly than the revision tree, i.e. a workingtree.
             The revision tree will be used for cases where accelerator_tree's
             content is different.
+        :param hardlink: If true, hard-link files from accelerator_tree,
+            where possible.
         """
         if not isinstance(a_bzrdir.transport, LocalTransport):
             raise errors.NotLocalUrl(a_bzrdir.transport.base)

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2008-02-11 11:24:11 +0000
+++ b/bzrlib/workingtree_4.py	2008-02-24 17:19:56 +0000
@@ -1259,7 +1259,7 @@
         return "Working tree format 4"
 
     def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
-                   accelerator_tree=None):
+                   accelerator_tree=None, hardlink=False):
         """See WorkingTreeFormat.initialize().
 
         :param revision_id: allows creating a working tree at a different
@@ -1268,6 +1268,8 @@
             contents more quickly than the revision tree, i.e. a workingtree.
             The revision tree will be used for cases where accelerator_tree's
             content is different.
+        :param hardlink: If true, hard-link files from accelerator_tree,
+            where possible.
 
         These trees get an initial random root id, if their repository supports
         rich root data, TREE_ROOT otherwise.
@@ -1320,16 +1322,19 @@
             else:
                 parents_list = [(revision_id, basis)]
             basis.lock_read()
-            wt.set_parent_trees(parents_list, allow_leftmost_as_ghost=True)
-            wt.flush()
-            # if the basis has a root id we have to use that; otherwise we use
-            # a new random one
-            basis_root_id = basis.get_root_id()
-            if basis_root_id is not None:
-                wt._set_root_id(basis_root_id)
+            try:
+                wt.set_parent_trees(parents_list, allow_leftmost_as_ghost=True)
                 wt.flush()
-            transform.build_tree(basis, wt, accelerator_tree)
-            basis.unlock()
+                # if the basis has a root id we have to use that; otherwise we
+                # use a new random one
+                basis_root_id = basis.get_root_id()
+                if basis_root_id is not None:
+                    wt._set_root_id(basis_root_id)
+                    wt.flush()
+                transform.build_tree(basis, wt, accelerator_tree,
+                                     hardlink=hardlink)
+            finally:
+                basis.unlock()
         finally:
             control_files.unlock()
             wt.unlock()




More information about the bazaar-commits mailing list