Merge lp:~mbp/bzr/340352-rename-lock into lp:~bzr/bzr/trunk-old

Proposed by Martin Pool
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mbp/bzr/340352-rename-lock
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 345 lines (has conflicts)
Text conflict in NEWS
To merge this branch: bzr merge lp:~mbp/bzr/340352-rename-lock
Reviewer Review Type Date Requested Status
John A Meinel Needs Information
Robert Collins (community) Needs Fixing
Review via email: mp+4334@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

bzr internally expects DirectoryNotEmpty and relies on transports to translate it to that form.

=== modified file 'NEWS'
--- NEWS 2009-03-10 06:46:19 +0000
+++ NEWS 2009-03-10 07:28:23 +0000
@@ -114,6 +114,9 @@
     * Export now handles files that are not present in the tree.
       (James Westby, #174539)

+ * Fix problem of "directory not empty" when contending for a lock over
+ sftp. (Martin Pool, #340352)
+
     * Fixed "sprout() got an unexpected keyword argument 'source_branch'"
       error branching from old repositories.
       (Martin Pool, #321695)

=== modified file 'bzrlib/transport/sftp.py'
--- bzrlib/transport/sftp.py 2009-02-23 15:29:35 +0000
+++ bzrlib/transport/sftp.py 2009-03-10 07:24:55 +0000
@@ -692,6 +692,9 @@
         # paramiko seems to generate detailless errors.
         self._translate_error(e, path, raise_generic=False)
         if getattr(e, 'args', None) is not None:
+ # 29.993 Raising exception with args ('Directory not empty:
+ # "/srv/bazaar.launchpad.net/push-branches/00/00/94/67/.bzr/branch/lock/xrdlfxf6nl.tmp":
+ # [Errno 39] Directory not empty',)
             if (e.args == ('No such file or directory',) or
                 e.args == ('No such file',)):
                 raise NoSuchFile(path, str(e) + more_info)
@@ -701,6 +704,9 @@
             # strange but true, for the paramiko server.
             if (e.args == ('Failure',)):
                 raise failure_exc(path, str(e) + more_info)
+ if (e.args[0].startswith('Directory not empty: ')
+ or getattr(e, 'errno', None) == errno.ENOTEMPTY):
+ raise errors.DirectoryNotEmpty(path, str(e))
             mutter('Raising exception with args %s', e.args)
         if getattr(e, 'errno', None) is not None:
             mutter('Raising exception with errno %s', e.errno)

Revision history for this message
Robert Collins (lifeless) wrote :

the comment block is out of place; it looks like notes you had while developing the code but not particularly helpful where it is. I'd either remove it or move to the if clause its on and add a little exposition.

review: Needs Fixing
Revision history for this message
John A Meinel (jameinel) wrote :

Is there something wrong with the diff? I see a bunch of stuff about HookPoint which doesn't seem to be part of the actual patch.

review: Needs Information
Revision history for this message
Martin Pool (mbp) wrote :

> the comment block is out of place; it looks like notes you had while
> developing the code but not particularly helpful where it is. I'd either
> remove it or move to the if clause its on and add a little exposition.

It's meant to give an example of the kind of string that is raised. I'll make this clearer.

Revision history for this message
Martin Pool (mbp) wrote :

> Is there something wrong with the diff? I see a bunch of stuff about HookPoint
> which doesn't seem to be part of the actual patch.

I guess that's due to <https://bugs.edge.launchpad.net/launchpad-code/+bug/338002>. When I check diff -rsubmit: it shows only what it should.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2009-03-24 12:15:01 +0000
+++ NEWS 2009-03-24 21:35:19 +0000
@@ -1,5 +1,6 @@
1====================1====================
2Bazaar Release Notes2Bazaar Release Notes
3<<<<<<< TREE
3====================4====================
45
56
@@ -599,6 +600,310 @@
599:Codename: 1234567890600:Codename: 1234567890
600:1.12: 2009-02-13601:1.12: 2009-02-13
601:1.12rc1: 2009-02-10602:1.12rc1: 2009-02-10
603=======
604--------------------
605
606.. contents::
607
608
609IN DEVELOPMENT
610--------------
611
612 COMPATIBILITY BREAKS:
613
614 * ``bzr log --line`` now indicates which revisions are merges with
615 `[merge]` after the date. Scripts which parse the output of this
616 command may need to be adjusted.
617 (Neil Martinsen-Burrell)
618
619 NEW FEATURES:
620
621 * ``bzr reconfigure`` now supports --with-trees and --with-no-trees
622 options to change the default tree-creation policy of shared
623 repositories. (Matthew Fuller, Marius Kruger, #145033)
624
625 * Debug flags can now be set in ``~/.bazaar/bazaar.conf``.
626 (Martin Pool)
627
628 * Filtered views provide a mask over the tree so that users can focus
629 on a subset of a tree when doing their work. See ``Filtered views``
630 in chapter 7 of the User Guide and ``bzr help view`` for details.
631 (Ian Clatworthy)
632
633 * GNU Changelog output can now be produced by ``bzr log --format
634 gnu-changelog``. (Andrea Bolognani, Martin Pool)
635
636 * The ``-Dmemory`` flag now gives memory information on Windows.
637 (John Arbash Meinel)
638
639 * Multiple authors for a commit can now be recorded by using the "--author"
640 option multiple times. (James Westby, #185772)
641
642 * New clean-tree command, from bzrtools. (Aaron Bentley, Jelmer Vernoij)
643
644 * New command ``bzr launchpad-open`` opens a Launchpad web page for that
645 branch in your web browser, as long as the branch is on Launchpad at all.
646 (Jonathan Lange)
647
648 IMPROVEMENTS:
649
650 * ``bzr add`` no longer prints ``add completed`` on success. Failure
651 still prints an error message. (Robert Collins)
652
653 * ``bzr branch`` now has a ``--no-tree`` option which turns off the
654 generation of a working tree in the new branch.
655 (Daniel Watkins, John Klinger, #273993)
656
657 * Bazaar will now point out ``bzr+ssh://`` to the user when they
658 use ssh://. (Jelmer Vernooij, #330535)
659
660 * ``bzr -v info`` now omits the number of committers branch statistic,
661 making it many times faster for large projects. To include that
662 statistic in the output, use ``bzr -vv info``.
663 (Ian Clatworthy)
664
665 * ``bzr push`` to a ``bzr`` url (``bzr://``, ``bzr+ssh://`` etc) will
666 stream if the server is version 1.13 or greater, reducing roundtrips
667 significantly. (Andrew Bennetts, Robert Collins)
668
669 * Lightweight Checkouts and Stacked Branches should both be much
670 faster over remote connections. Building the working tree now
671 batches up requests into approx 5MB requests, rather than a separate
672 request for each file. (John Arbash Meinel)
673
674 * Progress bars now show the rate of network activity for
675 ``bzr+ssh://`` and ``bzr://`` connections. (Andrew Bennetts)
676
677 * Support for GSSAPI authentication when using HTTP or HTTPS.
678 (Jelmer Vernooij)
679
680 * The ``bzr shelve`` prompt now includes a '?' help option to explain the
681 short options better. (Daniel Watkins, #327429)
682
683 * ``bzr lp-open`` now falls back to the push location if it cannot find a
684 public location. (Jonathan Lange, #332372)
685
686 * ``bzr lp-open`` will try to find the Launchpad URL for the location
687 passed on the command line. This makes ``bzr lp-open lp:foo`` work as
688 expected. (Jonathan Lange, #332705)
689
690 * ``bzr send`` now supports MH-E via ``emacsclient``. (Eric Gillespie)
691
692 BUG FIXES:
693
694 * Bazaar now gives a better message including the filename if it's
695 unable to read a file in the working directory, for example because
696 of a permission error. (Martin Pool, #338653)
697
698 * ``bzr send`` help is more specific about how to apply merge
699 directives. (Neil Martinsen-Burrell, #253470)
700
701 * ``bzr missing`` now uses ``Repository.get_revision_delta()`` rather
702 than fetching trees and determining a delta itself. (Jelmer
703 Vernooij, #315048)
704
705 * ``bzr push`` to a smart server no longer causes "Revision
706 {set([('null:',)])} not present ..." errors when the branch has
707 multiple root revisions. (Andrew Bennetts, #317654)
708
709 * ``bzr shelve`` now properly handle patches with no terminating newline.
710 (Benoît PIERRE, #303569)
711
712 * ``bzr unshelve`` gives a more palatable error if passed a non-integer
713 shelf id. (Daniel Watkins)
714
715 * Export now handles files that are not present in the tree.
716 (James Westby, #174539)
717
718 * Fix problem of "directory not empty" when contending for a lock over
719 sftp. (Martin Pool, #340352)
720
721 * Fixed "sprout() got an unexpected keyword argument 'source_branch'"
722 error branching from old repositories.
723 (Martin Pool, #321695)
724
725 * Make ``bzr push --quiet <non-local location>`` less chatty.
726 (Kent Gibson, #221461)
727
728 * Many Branch hooks would not fire with ``bzr://`` and ``bzr+ssh://``
729 branches, and this was not noticed due to a bug in the test logic
730 for branches. This is now fixed and a test added to prevent it
731 reoccuring. (Robert Collins, Andrew Bennetts)
732
733 * Restore the progress bar on Windows. We were disabling it when TERM
734 wasn't set, but Windows doesn't set TERM. (Alexander Belchenko)
735
736 * ``setup.py build_ext`` now gives a proper error when an extension
737 fails to build. (John Arbash Meinel)
738
739 * Under rare circumstances (aka nobody reported a bug about it), the ftp
740 transport could revert to ascii mode. It now stays in binary mode except
741 when needed.
742 (Vincent Ladeuil)
743
744 * Unshelve does not generate warnings about progress bars.
745 (Aaron Bentley, #328148)
746
747 DOCUMENTATION:
748
749 * Added ``Organizing your workspace`` to the User Guide appendices,
750 summarizing some common ways of organizing trees, branches and
751 repositories and the processes/workflows implied/enabled by each.
752 (Ian Clatworthy)
753
754 * Hooks can now be self documenting. ``bzrlib.hooks.Hooks.create_hook``
755 is the entry point for this feature. (Robert Collins)
756
757 * The documentation for ``shelve`` and ``unshelve`` has been clarified.
758 (Daniel Watkins, #327421, #327425)
759
760 API CHANGES:
761
762 * ``bzr selftest`` now fails if the bazaar sources contain trailing
763 whitespace, non-unix style line endings and files not ending in a
764 newline. About 372 files and 3243 lines with trailing whitespace was
765 updated to comply with this. The code already complied with the other
766 criteria, but now it is enforced. (Marius Kruger)
767
768 * ``Branch.fetch`` and ``Repository.fetch`` now return None rather
769 than a count of copied revisions and failed revisions. A while back
770 we stopped ever reporting failed revisions because we started
771 erroring instead, and the copied revisions count is not used in the
772 UI at all - indeed it only reflects the repository status not
773 changes to the branch itself. (Robert Collins)
774
775 * MutableTree.commit now favours the "authors" argument, with the old
776 "author" argument being deprecated.
777
778 * Remove deprecated EmptyTree. (Martin Pool)
779
780 * ``Repository.fetch`` now accepts an optional ``fetch_spec``
781 parameter. A ``SearchResult`` or ``MiniSearchResult`` may be passed
782 to ``fetch_spec`` instead of a ``last_revision`` to specify exactly
783 which revisions to fetch. (Andrew Bennetts)
784
785 * ``RepositoryAcquisitionPolicy.acquire_repository`` now returns a
786 tuple of ``(repository, is_new_flag)``, rather than just the
787 repository. (Andrew Bennetts)
788
789 * Revision.get_apparent_author() is now deprecated, replaced by
790 Revision.get_apparent_authors(), which returns a list. The former
791 now returns the first item that would be returned from the second.
792
793 * The ``BranchBuilder`` test helper now accepts a ``timestamp``
794 parameter to ``build_commit`` and ``build_snapshot``. (Martin Pool)
795
796 * The ``_fetch_*`` attributes on ``Repository`` are now on
797 ``RepositoryFormat``, more accurately reflecting their intent (they
798 describe a disk format capability, not state of a particular
799 repository of that format). (Robert Collins)
800
801 INTERNALS:
802
803 * Branching from a non-stacked branch on a smart protocol is now
804 free of virtual file system methods.
805 (Robert Collins, Andrew Bennetts)
806
807 * Branch and Repository creation on a bzr+ssh://server are now done
808 via RPC calls rather than VFS calls, reducing round trips for
809 pushing new branches substantially. (Robert Collins)
810
811 * ``Branch.clone`` now takes the ``repository_policy`` formerly used
812 inside ``BzrDir.clone_on_transport``, allowing stacking to be
813 configured before the branch tags and revision tip are set. This
814 fixes a race condition cloning stacked branches that would cause
815 plugins to have hooks called on non-stacked instances.
816 (Robert Collins, #334187)
817
818 * ``BzrDir.cloning_metadir`` now has a RPC call. (Robert Collins)
819
820 * ``BzrDirFormat.__str__`` now uses the human readable description
821 rather than the sometimes-absent disk label. (Robert Collins)
822
823 * ``bzrlib.fetch`` is now composed of a sender and a sink component
824 allowing for decoupling over a network connection. Fetching from
825 or into a RemoteRepository with a 1.13 server will use this to
826 stream the operation.
827 (Andrew Bennetts, Robert Collins)
828
829 * ``bzrlib.tests.run_suite`` accepts a runner_class parameter
830 supporting the use of different runners. (Robert Collins)
831
832 * Change how file_ids and revision_ids are interned as part of
833 inventory deserialization. Now we use the real ``intern()``, rather
834 than our own workaround that would also cache a Unicode copy of the
835 string, and never emptied the cache. This should slightly reduce
836 memory consumption. (John Arbash Meinel)
837
838 * New branch method ``create_clone_on_transport`` that returns a
839 branch object. (Robert Collins)
840
841 * New hook Commands['extend_command'] to allow plugins to access a
842 command object before the command is run (or help generated from
843 it), without overriding the command. (Robert Collins)
844
845 * New version of the ``BzrDir.find_repository`` verb supporting
846 ``_network_name`` to support removing more _ensure_real calls.
847 (Robert Collins)
848
849 * ``RemoteBranchFormat`` no longer claims to have a disk format string.
850 (Robert Collins)
851
852 * ``Repository`` objects now have ``suspend_write_group`` and
853 ``resume_write_group`` methods. These are currently only useful
854 with pack repositories. (Andrew Bennetts, Robert Collins)
855
856 * ``BzrDirFormat``, ``BranchFormat`` and ``RepositoryFormat`` objects
857 now have a ``network_name`` for passing the format across RPC calls.
858 (Robert Collins, Andrew Bennetts)
859
860 * ``RepositoryFormat`` objects now all have a new attribute
861 ``_serializer`` used by fetch when reserialising is required.
862 (Robert Collins, Andrew Bennetts)
863
864 * Some methods have been pulled up from ``BzrBranch`` to ``Branch``
865 to aid branch types that are not bzr branch objects (like
866 RemoteBranch). (Robert Collins, Andrew Bennetts)
867
868 * Test adaptation has been made consistent throughout the built in
869 tests. ``TestScenarioApplier``, ``multiply_tests_from_modules``,
870 ``adapt_tests``, ``adapt_modules`` have all been deleted. Please
871 use ``multiply_tests``, or for lower level needs ``apply_scenarios``
872 and ``apply_scenario``. (Robert Collins)
873
874 * ``TestSkipped`` is now detected by TestCase and passed to the
875 ``TestResult`` by calling ``addSkip``. For older TestResult objects,
876 where ``addSkip`` is not available, ``addError`` is still called.
877 This permits test filtering in subunit to strip out skipped tests
878 resulting in a faster fix-shrink-list-run cycle. This is compatible
879 with the testtools protocol for skips. (Robert Collins)
880
881 * The ``_index`` of ``KnitVersionedFiles`` now supports the ability
882 to scan an underlying index that is going to be incorporated into
883 the ``KnitVersionedFiles`` object, to determine if it has missing
884 delta references. The method is ``scan_unvalidated_index``.
885 (Andrew Bennetts, Robert Collins)
886
887 * There is a RemoteSink object which handles pushing to smart servers.
888 (Andrew Bennetts, Robert Collins)
889
890 * ``TransportTraceDecorator`` now logs ``put_bytes_non_atomic`` and
891 ``rmdir`` calls. (Robert Collins)
892
893 * ``VersionedFiles`` record adapters have had their signature change
894 from ``(record, record.get_bytes_as(record.storage_kind))`` to
895 ``(record)`` reducing excess duplication and allowing adapters
896 to access private data in record to obtain content more
897 efficiently. (Robert Collins)
898
899 * We no longer probe to see if we should create a working tree during
900 clone if we cannot get a local_abspath for the new bzrdir.
901 (Robert Collins)
902
903
904bzr 1.12 "1234567890" 2009-02-13
905--------------------------------
906>>>>>>> MERGE-SOURCE
602907
603This release of Bazaar contains many improvements to the speed,908This release of Bazaar contains many improvements to the speed,
604documentation and functionality of ``bzr log`` and the display of logged909documentation and functionality of ``bzr log`` and the display of logged
605910
=== modified file 'bzrlib/transport/sftp.py'
--- bzrlib/transport/sftp.py 2009-03-23 14:59:43 +0000
+++ bzrlib/transport/sftp.py 2009-03-24 21:35:19 +0000
@@ -702,6 +702,9 @@
702 # paramiko seems to generate detailless errors.702 # paramiko seems to generate detailless errors.
703 self._translate_error(e, path, raise_generic=False)703 self._translate_error(e, path, raise_generic=False)
704 if getattr(e, 'args', None) is not None:704 if getattr(e, 'args', None) is not None:
705 # 29.993 Raising exception with args ('Directory not empty:
706 # "/srv/bazaar.launchpad.net/push-branches/00/00/94/67/.bzr/branch/lock/xrdlfxf6nl.tmp":
707 # [Errno 39] Directory not empty',)
705 if (e.args == ('No such file or directory',) or708 if (e.args == ('No such file or directory',) or
706 e.args == ('No such file',)):709 e.args == ('No such file',)):
707 raise NoSuchFile(path, str(e) + more_info)710 raise NoSuchFile(path, str(e) + more_info)
@@ -711,6 +714,9 @@
711 # strange but true, for the paramiko server.714 # strange but true, for the paramiko server.
712 if (e.args == ('Failure',)):715 if (e.args == ('Failure',)):
713 raise failure_exc(path, str(e) + more_info)716 raise failure_exc(path, str(e) + more_info)
717 if (e.args[0].startswith('Directory not empty: ')
718 or getattr(e, 'errno', None) == errno.ENOTEMPTY):
719 raise errors.DirectoryNotEmpty(path, str(e))
714 mutter('Raising exception with args %s', e.args)720 mutter('Raising exception with args %s', e.args)
715 if getattr(e, 'errno', None) is not None:721 if getattr(e, 'errno', None) is not None:
716 mutter('Raising exception with errno %s', e.errno)722 mutter('Raising exception with errno %s', e.errno)