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
1=== modified file 'NEWS'
2--- NEWS 2009-03-24 12:15:01 +0000
3+++ NEWS 2009-03-24 21:35:19 +0000
4@@ -1,5 +1,6 @@
5 ====================
6 Bazaar Release Notes
7+<<<<<<< TREE
8 ====================
9
10
11@@ -599,6 +600,310 @@
12 :Codename: 1234567890
13 :1.12: 2009-02-13
14 :1.12rc1: 2009-02-10
15+=======
16+--------------------
17+
18+.. contents::
19+
20+
21+IN DEVELOPMENT
22+--------------
23+
24+ COMPATIBILITY BREAKS:
25+
26+ * ``bzr log --line`` now indicates which revisions are merges with
27+ `[merge]` after the date. Scripts which parse the output of this
28+ command may need to be adjusted.
29+ (Neil Martinsen-Burrell)
30+
31+ NEW FEATURES:
32+
33+ * ``bzr reconfigure`` now supports --with-trees and --with-no-trees
34+ options to change the default tree-creation policy of shared
35+ repositories. (Matthew Fuller, Marius Kruger, #145033)
36+
37+ * Debug flags can now be set in ``~/.bazaar/bazaar.conf``.
38+ (Martin Pool)
39+
40+ * Filtered views provide a mask over the tree so that users can focus
41+ on a subset of a tree when doing their work. See ``Filtered views``
42+ in chapter 7 of the User Guide and ``bzr help view`` for details.
43+ (Ian Clatworthy)
44+
45+ * GNU Changelog output can now be produced by ``bzr log --format
46+ gnu-changelog``. (Andrea Bolognani, Martin Pool)
47+
48+ * The ``-Dmemory`` flag now gives memory information on Windows.
49+ (John Arbash Meinel)
50+
51+ * Multiple authors for a commit can now be recorded by using the "--author"
52+ option multiple times. (James Westby, #185772)
53+
54+ * New clean-tree command, from bzrtools. (Aaron Bentley, Jelmer Vernoij)
55+
56+ * New command ``bzr launchpad-open`` opens a Launchpad web page for that
57+ branch in your web browser, as long as the branch is on Launchpad at all.
58+ (Jonathan Lange)
59+
60+ IMPROVEMENTS:
61+
62+ * ``bzr add`` no longer prints ``add completed`` on success. Failure
63+ still prints an error message. (Robert Collins)
64+
65+ * ``bzr branch`` now has a ``--no-tree`` option which turns off the
66+ generation of a working tree in the new branch.
67+ (Daniel Watkins, John Klinger, #273993)
68+
69+ * Bazaar will now point out ``bzr+ssh://`` to the user when they
70+ use ssh://. (Jelmer Vernooij, #330535)
71+
72+ * ``bzr -v info`` now omits the number of committers branch statistic,
73+ making it many times faster for large projects. To include that
74+ statistic in the output, use ``bzr -vv info``.
75+ (Ian Clatworthy)
76+
77+ * ``bzr push`` to a ``bzr`` url (``bzr://``, ``bzr+ssh://`` etc) will
78+ stream if the server is version 1.13 or greater, reducing roundtrips
79+ significantly. (Andrew Bennetts, Robert Collins)
80+
81+ * Lightweight Checkouts and Stacked Branches should both be much
82+ faster over remote connections. Building the working tree now
83+ batches up requests into approx 5MB requests, rather than a separate
84+ request for each file. (John Arbash Meinel)
85+
86+ * Progress bars now show the rate of network activity for
87+ ``bzr+ssh://`` and ``bzr://`` connections. (Andrew Bennetts)
88+
89+ * Support for GSSAPI authentication when using HTTP or HTTPS.
90+ (Jelmer Vernooij)
91+
92+ * The ``bzr shelve`` prompt now includes a '?' help option to explain the
93+ short options better. (Daniel Watkins, #327429)
94+
95+ * ``bzr lp-open`` now falls back to the push location if it cannot find a
96+ public location. (Jonathan Lange, #332372)
97+
98+ * ``bzr lp-open`` will try to find the Launchpad URL for the location
99+ passed on the command line. This makes ``bzr lp-open lp:foo`` work as
100+ expected. (Jonathan Lange, #332705)
101+
102+ * ``bzr send`` now supports MH-E via ``emacsclient``. (Eric Gillespie)
103+
104+ BUG FIXES:
105+
106+ * Bazaar now gives a better message including the filename if it's
107+ unable to read a file in the working directory, for example because
108+ of a permission error. (Martin Pool, #338653)
109+
110+ * ``bzr send`` help is more specific about how to apply merge
111+ directives. (Neil Martinsen-Burrell, #253470)
112+
113+ * ``bzr missing`` now uses ``Repository.get_revision_delta()`` rather
114+ than fetching trees and determining a delta itself. (Jelmer
115+ Vernooij, #315048)
116+
117+ * ``bzr push`` to a smart server no longer causes "Revision
118+ {set([('null:',)])} not present ..." errors when the branch has
119+ multiple root revisions. (Andrew Bennetts, #317654)
120+
121+ * ``bzr shelve`` now properly handle patches with no terminating newline.
122+ (BenoƮt PIERRE, #303569)
123+
124+ * ``bzr unshelve`` gives a more palatable error if passed a non-integer
125+ shelf id. (Daniel Watkins)
126+
127+ * Export now handles files that are not present in the tree.
128+ (James Westby, #174539)
129+
130+ * Fix problem of "directory not empty" when contending for a lock over
131+ sftp. (Martin Pool, #340352)
132+
133+ * Fixed "sprout() got an unexpected keyword argument 'source_branch'"
134+ error branching from old repositories.
135+ (Martin Pool, #321695)
136+
137+ * Make ``bzr push --quiet <non-local location>`` less chatty.
138+ (Kent Gibson, #221461)
139+
140+ * Many Branch hooks would not fire with ``bzr://`` and ``bzr+ssh://``
141+ branches, and this was not noticed due to a bug in the test logic
142+ for branches. This is now fixed and a test added to prevent it
143+ reoccuring. (Robert Collins, Andrew Bennetts)
144+
145+ * Restore the progress bar on Windows. We were disabling it when TERM
146+ wasn't set, but Windows doesn't set TERM. (Alexander Belchenko)
147+
148+ * ``setup.py build_ext`` now gives a proper error when an extension
149+ fails to build. (John Arbash Meinel)
150+
151+ * Under rare circumstances (aka nobody reported a bug about it), the ftp
152+ transport could revert to ascii mode. It now stays in binary mode except
153+ when needed.
154+ (Vincent Ladeuil)
155+
156+ * Unshelve does not generate warnings about progress bars.
157+ (Aaron Bentley, #328148)
158+
159+ DOCUMENTATION:
160+
161+ * Added ``Organizing your workspace`` to the User Guide appendices,
162+ summarizing some common ways of organizing trees, branches and
163+ repositories and the processes/workflows implied/enabled by each.
164+ (Ian Clatworthy)
165+
166+ * Hooks can now be self documenting. ``bzrlib.hooks.Hooks.create_hook``
167+ is the entry point for this feature. (Robert Collins)
168+
169+ * The documentation for ``shelve`` and ``unshelve`` has been clarified.
170+ (Daniel Watkins, #327421, #327425)
171+
172+ API CHANGES:
173+
174+ * ``bzr selftest`` now fails if the bazaar sources contain trailing
175+ whitespace, non-unix style line endings and files not ending in a
176+ newline. About 372 files and 3243 lines with trailing whitespace was
177+ updated to comply with this. The code already complied with the other
178+ criteria, but now it is enforced. (Marius Kruger)
179+
180+ * ``Branch.fetch`` and ``Repository.fetch`` now return None rather
181+ than a count of copied revisions and failed revisions. A while back
182+ we stopped ever reporting failed revisions because we started
183+ erroring instead, and the copied revisions count is not used in the
184+ UI at all - indeed it only reflects the repository status not
185+ changes to the branch itself. (Robert Collins)
186+
187+ * MutableTree.commit now favours the "authors" argument, with the old
188+ "author" argument being deprecated.
189+
190+ * Remove deprecated EmptyTree. (Martin Pool)
191+
192+ * ``Repository.fetch`` now accepts an optional ``fetch_spec``
193+ parameter. A ``SearchResult`` or ``MiniSearchResult`` may be passed
194+ to ``fetch_spec`` instead of a ``last_revision`` to specify exactly
195+ which revisions to fetch. (Andrew Bennetts)
196+
197+ * ``RepositoryAcquisitionPolicy.acquire_repository`` now returns a
198+ tuple of ``(repository, is_new_flag)``, rather than just the
199+ repository. (Andrew Bennetts)
200+
201+ * Revision.get_apparent_author() is now deprecated, replaced by
202+ Revision.get_apparent_authors(), which returns a list. The former
203+ now returns the first item that would be returned from the second.
204+
205+ * The ``BranchBuilder`` test helper now accepts a ``timestamp``
206+ parameter to ``build_commit`` and ``build_snapshot``. (Martin Pool)
207+
208+ * The ``_fetch_*`` attributes on ``Repository`` are now on
209+ ``RepositoryFormat``, more accurately reflecting their intent (they
210+ describe a disk format capability, not state of a particular
211+ repository of that format). (Robert Collins)
212+
213+ INTERNALS:
214+
215+ * Branching from a non-stacked branch on a smart protocol is now
216+ free of virtual file system methods.
217+ (Robert Collins, Andrew Bennetts)
218+
219+ * Branch and Repository creation on a bzr+ssh://server are now done
220+ via RPC calls rather than VFS calls, reducing round trips for
221+ pushing new branches substantially. (Robert Collins)
222+
223+ * ``Branch.clone`` now takes the ``repository_policy`` formerly used
224+ inside ``BzrDir.clone_on_transport``, allowing stacking to be
225+ configured before the branch tags and revision tip are set. This
226+ fixes a race condition cloning stacked branches that would cause
227+ plugins to have hooks called on non-stacked instances.
228+ (Robert Collins, #334187)
229+
230+ * ``BzrDir.cloning_metadir`` now has a RPC call. (Robert Collins)
231+
232+ * ``BzrDirFormat.__str__`` now uses the human readable description
233+ rather than the sometimes-absent disk label. (Robert Collins)
234+
235+ * ``bzrlib.fetch`` is now composed of a sender and a sink component
236+ allowing for decoupling over a network connection. Fetching from
237+ or into a RemoteRepository with a 1.13 server will use this to
238+ stream the operation.
239+ (Andrew Bennetts, Robert Collins)
240+
241+ * ``bzrlib.tests.run_suite`` accepts a runner_class parameter
242+ supporting the use of different runners. (Robert Collins)
243+
244+ * Change how file_ids and revision_ids are interned as part of
245+ inventory deserialization. Now we use the real ``intern()``, rather
246+ than our own workaround that would also cache a Unicode copy of the
247+ string, and never emptied the cache. This should slightly reduce
248+ memory consumption. (John Arbash Meinel)
249+
250+ * New branch method ``create_clone_on_transport`` that returns a
251+ branch object. (Robert Collins)
252+
253+ * New hook Commands['extend_command'] to allow plugins to access a
254+ command object before the command is run (or help generated from
255+ it), without overriding the command. (Robert Collins)
256+
257+ * New version of the ``BzrDir.find_repository`` verb supporting
258+ ``_network_name`` to support removing more _ensure_real calls.
259+ (Robert Collins)
260+
261+ * ``RemoteBranchFormat`` no longer claims to have a disk format string.
262+ (Robert Collins)
263+
264+ * ``Repository`` objects now have ``suspend_write_group`` and
265+ ``resume_write_group`` methods. These are currently only useful
266+ with pack repositories. (Andrew Bennetts, Robert Collins)
267+
268+ * ``BzrDirFormat``, ``BranchFormat`` and ``RepositoryFormat`` objects
269+ now have a ``network_name`` for passing the format across RPC calls.
270+ (Robert Collins, Andrew Bennetts)
271+
272+ * ``RepositoryFormat`` objects now all have a new attribute
273+ ``_serializer`` used by fetch when reserialising is required.
274+ (Robert Collins, Andrew Bennetts)
275+
276+ * Some methods have been pulled up from ``BzrBranch`` to ``Branch``
277+ to aid branch types that are not bzr branch objects (like
278+ RemoteBranch). (Robert Collins, Andrew Bennetts)
279+
280+ * Test adaptation has been made consistent throughout the built in
281+ tests. ``TestScenarioApplier``, ``multiply_tests_from_modules``,
282+ ``adapt_tests``, ``adapt_modules`` have all been deleted. Please
283+ use ``multiply_tests``, or for lower level needs ``apply_scenarios``
284+ and ``apply_scenario``. (Robert Collins)
285+
286+ * ``TestSkipped`` is now detected by TestCase and passed to the
287+ ``TestResult`` by calling ``addSkip``. For older TestResult objects,
288+ where ``addSkip`` is not available, ``addError`` is still called.
289+ This permits test filtering in subunit to strip out skipped tests
290+ resulting in a faster fix-shrink-list-run cycle. This is compatible
291+ with the testtools protocol for skips. (Robert Collins)
292+
293+ * The ``_index`` of ``KnitVersionedFiles`` now supports the ability
294+ to scan an underlying index that is going to be incorporated into
295+ the ``KnitVersionedFiles`` object, to determine if it has missing
296+ delta references. The method is ``scan_unvalidated_index``.
297+ (Andrew Bennetts, Robert Collins)
298+
299+ * There is a RemoteSink object which handles pushing to smart servers.
300+ (Andrew Bennetts, Robert Collins)
301+
302+ * ``TransportTraceDecorator`` now logs ``put_bytes_non_atomic`` and
303+ ``rmdir`` calls. (Robert Collins)
304+
305+ * ``VersionedFiles`` record adapters have had their signature change
306+ from ``(record, record.get_bytes_as(record.storage_kind))`` to
307+ ``(record)`` reducing excess duplication and allowing adapters
308+ to access private data in record to obtain content more
309+ efficiently. (Robert Collins)
310+
311+ * We no longer probe to see if we should create a working tree during
312+ clone if we cannot get a local_abspath for the new bzrdir.
313+ (Robert Collins)
314+
315+
316+bzr 1.12 "1234567890" 2009-02-13
317+--------------------------------
318+>>>>>>> MERGE-SOURCE
319
320 This release of Bazaar contains many improvements to the speed,
321 documentation and functionality of ``bzr log`` and the display of logged
322
323=== modified file 'bzrlib/transport/sftp.py'
324--- bzrlib/transport/sftp.py 2009-03-23 14:59:43 +0000
325+++ bzrlib/transport/sftp.py 2009-03-24 21:35:19 +0000
326@@ -702,6 +702,9 @@
327 # paramiko seems to generate detailless errors.
328 self._translate_error(e, path, raise_generic=False)
329 if getattr(e, 'args', None) is not None:
330+ # 29.993 Raising exception with args ('Directory not empty:
331+ # "/srv/bazaar.launchpad.net/push-branches/00/00/94/67/.bzr/branch/lock/xrdlfxf6nl.tmp":
332+ # [Errno 39] Directory not empty',)
333 if (e.args == ('No such file or directory',) or
334 e.args == ('No such file',)):
335 raise NoSuchFile(path, str(e) + more_info)
336@@ -711,6 +714,9 @@
337 # strange but true, for the paramiko server.
338 if (e.args == ('Failure',)):
339 raise failure_exc(path, str(e) + more_info)
340+ if (e.args[0].startswith('Directory not empty: ')
341+ or getattr(e, 'errno', None) == errno.ENOTEMPTY):
342+ raise errors.DirectoryNotEmpty(path, str(e))
343 mutter('Raising exception with args %s', e.args)
344 if getattr(e, 'errno', None) is not None:
345 mutter('Raising exception with errno %s', e.errno)