Merge lp:~doxxx/bzr/271790 into lp:bzr

Proposed by Gordon Tyler
Status: Merged
Merged at revision: not available
Proposed branch: lp:~doxxx/bzr/271790
Merge into: lp:bzr
Diff against target: 62 lines (+18/-3)
3 files modified
NEWS (+5/-0)
bzrlib/builtins.py (+5/-3)
bzrlib/tests/blackbox/test_mv.py (+8/-0)
To merge this branch: bzr merge lp:~doxxx/bzr/271790
Reviewer Review Type Date Requested Status
Andrew Bennetts Needs Fixing
Robert Collins (community) Needs Fixing
Review via email: mp+14812@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Gordon Tyler (doxxx) wrote :

Fixed cmd_mv to use trace.note so that it obeys the --quiet option. I didn't add anything to the blackbox tests for mv to verify this, but I can if you want.

Revision history for this message
Andrew Bennetts (spiv) wrote :

This looks good to me. I've taken the liberty of adding a blackbox test and NEWS entry for you, as they were so simple:

=== modified file 'NEWS'
--- NEWS 2009-11-16 20:50:41 +0000
+++ NEWS 2009-11-17 01:03:27 +0000
@@ -19,10 +19,13 @@

 Bug Fixes
 *********
+
 * After renaming a file, the dirstate could accidentally reference
   ``source\\path`` rather than ``source/path`` on Windows. This might be a
   source of some dirstate-related failures. (John Arbash Meinel)

+* ``bzr mv --quiet`` really is quiet now. (Gordon Tyler, #271790)
+
 * Lots of bugfixes for the test suite on Windows. We should once again
   have a test suite with no failures on Windows. (Once all the patches
   have landed, remove this line.) (John Arbash Meinel)

=== modified file 'bzrlib/tests/blackbox/test_mv.py'
--- bzrlib/tests/blackbox/test_mv.py 2009-09-17 11:54:41 +0000
+++ bzrlib/tests/blackbox/test_mv.py 2009-11-17 01:07:13 +0000
@@ -487,6 +487,14 @@
         self.assertEqual('bzr: ERROR: --after cannot be specified with'
                          ' --auto.\n', err)

+ def test_mv_quiet(self):
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['aaa'])
+ tree.add(['aaa'])
+ out, err = self.run_bzr('mv --quiet aaa bbb')
+ self.assertEqual(out, '')
+ self.assertEqual(err, '')
+
     def test_mv_readonly_lightweight_checkout(self):
         branch = self.make_branch('foo')
         branch = bzrlib.branch.Branch.open(self.get_readonly_url('foo'))

I see on IRC that you just sent in a contributor agreement, and this is simple enough that I don't think a second review is needed, so I'll send this to PQM now. Thanks very much!

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

 review: needsfixing

Doesn't this move the list of files moved to stderr?
 Thats bad for folk capturing output IMO.

It should keep it on stdout.

-Rob

review: Needs Fixing
Revision history for this message
Gordon Tyler (doxxx) wrote :

After having discussed it with Robert on IRC and in light of Martin's forthcoming changes to the UIFactory, I should probably revisit this and address it properly in my output-cleanup branch.

Revision history for this message
Andrew Bennetts (spiv) wrote :

PQM rejected this. It turns out that it fails the test_non_ascii blackbox tests. If you run "./bzr selftest -s bb.test_non_ascii mv" you'll see the failures.

This appears to be because the output is now emitted to stderr rather than stdout. I think that's an undesireable change in behaviour, stdout feels like the right destination for this output to me. I guess the simplest change would be to continue to use self.outf, but first check is_quiet() (which is already imported from bzrlib.trace).

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

Yes, I think that's a better approach.

- Martin

On 17/11/2009 12:34 PM, "Andrew Bennetts" <email address hidden>
wrote:

Review: Needs Fixing
PQM rejected this. It turns out that it fails the test_non_ascii blackbox
tests. If you run "./bzr selftest -s bb.test_non_ascii mv" you'll see the
failures.

This appears to be because the output is now emitted to stderr rather than
stdout. I think that's an undesireable change in behaviour, stdout feels
like the right destination for this output to me. I guess the simplest
change would be to continue to use self.outf, but first check is_quiet()
(which is already imported from bzrlib.trace).

-- https://code.edge.launchpad.net/~doxxx/bzr/271790/+merge/14812 Your team
bzr-core is subscribed ...

Revision history for this message
Gordon Tyler (doxxx) wrote :

I've made the changes suggested and the bb.test_mv and bb.test_non_ascii mv tests succeed now.

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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Bennetts wrote:
> Review: Approve
> This looks good to me. I've taken the liberty of adding a blackbox test and NEWS entry for you, as they were so simple:
>

So this changes 'mv' to output what changed to stderr rather than
stdout. Which would break scripts, etc. I don't know of anyone who
depends on 'mv' going to stdout, but I think it should be documented
more clearly.

I *think* it needs an entry at least in Compatibility Breaks.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksCvHsACgkQJdeBCYSNAAPtBwCgmHLlR5sHaNtw6mFH1/LF0pAY
qPUAn3wQXtIdnObSb735GION57W4Csg8
=lgwg
-----END PGP SIGNATURE-----

Revision history for this message
Gordon Tyler (doxxx) wrote :

I don't know if you checked the diffs after my last update but it's really just been reverted back to what it did before, using self.outf.write, but it checks is_quiet first. So it's still going to stdout.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-11-17 02:34:42 +0000
3+++ NEWS 2009-11-17 03:57:10 +0000
4@@ -24,8 +24,13 @@
5 ``source\\path`` rather than ``source/path`` on Windows. This might be a
6 source of some dirstate-related failures. (John Arbash Meinel)
7
8+<<<<<<< TREE
9 * ``bzr ignore /`` no longer causes an IndexError. (Gorder Tyler, #456036)
10
11+=======
12+* ``bzr mv --quiet`` really is quiet now. (Gordon Tyler, #271790)
13+
14+>>>>>>> MERGE-SOURCE
15 * Lots of bugfixes for the test suite on Windows. We should once again
16 have a test suite with no failures on Windows. (Once all the patches
17 have landed, remove this line.) (John Arbash Meinel)
18
19=== modified file 'bzrlib/builtins.py'
20--- bzrlib/builtins.py 2009-11-12 07:47:19 +0000
21+++ bzrlib/builtins.py 2009-11-17 03:57:10 +0000
22@@ -849,8 +849,9 @@
23 # All entries reference existing inventory items, so fix them up
24 # for cicp file-systems.
25 rel_names = tree.get_canonical_inventory_paths(rel_names)
26- for pair in tree.move(rel_names[:-1], rel_names[-1], after=after):
27- self.outf.write("%s => %s\n" % pair)
28+ for src, dest in tree.move(rel_names[:-1], rel_names[-1], after=after):
29+ if not is_quiet():
30+ self.outf.write("%s => %s\n" % (src, dest))
31 else:
32 if len(names_list) != 2:
33 raise errors.BzrCommandError('to mv multiple files the'
34@@ -900,7 +901,8 @@
35 dest = osutils.pathjoin(dest_parent, dest_tail)
36 mutter("attempting to move %s => %s", src, dest)
37 tree.rename_one(src, dest, after=after)
38- self.outf.write("%s => %s\n" % (src, dest))
39+ if not is_quiet():
40+ self.outf.write("%s => %s\n" % (src, dest))
41
42
43 class cmd_pull(Command):
44
45=== modified file 'bzrlib/tests/blackbox/test_mv.py'
46--- bzrlib/tests/blackbox/test_mv.py 2009-09-17 11:54:41 +0000
47+++ bzrlib/tests/blackbox/test_mv.py 2009-11-17 03:57:10 +0000
48@@ -487,6 +487,14 @@
49 self.assertEqual('bzr: ERROR: --after cannot be specified with'
50 ' --auto.\n', err)
51
52+ def test_mv_quiet(self):
53+ tree = self.make_branch_and_tree('.')
54+ self.build_tree(['aaa'])
55+ tree.add(['aaa'])
56+ out, err = self.run_bzr('mv --quiet aaa bbb')
57+ self.assertEqual(out, '')
58+ self.assertEqual(err, '')
59+
60 def test_mv_readonly_lightweight_checkout(self):
61 branch = self.make_branch('foo')
62 branch = bzrlib.branch.Branch.open(self.get_readonly_url('foo'))