[MERGE] missing -q is quieter (#284748)
John Arbash Meinel
john at arbash-meinel.com
Fri Oct 17 05:14:32 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> bzr missing -q should say nothing unless there's an error, and just set the
> exit code.
>
>
> ------------------------------------------------------------------------
>
> # Bazaar merge directive format 2 (Bazaar 0.90)
> # revision_id: mbp at sourcefrog.net-20081017030138-wnnwb5wl60isaxjf
> # target_branch: http://bazaar-vcs.org/bzr/bzr.dev
> # testament_sha1: 699135165caf556b415ad43e85e50701c5664718
> # timestamp: 2008-10-17 14:02:15 +1100
> # source_branch: http://sourcefrog.net/bzr/284748-missing-quiet
> # base_revision_id: pqm at pqm.ubuntu.com-20081015214444-ztwoizx180edy73v
> #
> # Begin patch
> === modified file 'NEWS'
> --- NEWS 2008-10-15 19:07:11 +0000
> +++ NEWS 2008-10-17 03:01:38 +0000
> @@ -21,6 +21,10 @@
>
> BUG FIXES:
>
> + * ``bzr missing --quiet`` no longer prints messages about whether
> + there are missing revisions. The exit code indicates whether there
> + were or not. (Martin Pool, #284748)
> +
> DOCUMENTATION:
>
> API CHANGES:
>
> === modified file 'bzrlib/builtins.py'
> --- bzrlib/builtins.py 2008-10-12 16:11:17 +0000
> +++ bzrlib/builtins.py 2008-10-17 03:01:38 +0000
> @@ -3441,6 +3441,9 @@
> show_ids=False, verbose=False, this=False, other=False,
> include_merges=False):
> from bzrlib.missing import find_unmerged, iter_log_revisions
> + def message(s):
> + if not is_quiet():
> + self.outf.write(s)
>
> if this:
> mine_only = this
> @@ -3464,7 +3467,7 @@
> " or specified.")
> display_url = urlutils.unescape_for_display(parent,
> self.outf.encoding)
> - self.outf.write("Using saved parent location: "
> + message("Using saved parent location: "
> + display_url + "\n")
>
> remote_branch = Branch.open(other_branch)
> @@ -3488,7 +3491,7 @@
>
> status_code = 0
> if local_extra and not theirs_only:
> - self.outf.write("You have %d extra revision(s):\n" %
> + message("You have %d extra revision(s):\n" %
> len(local_extra))
^- I would re-wrap this
> for revision in iter_log_revisions(local_extra,
> local_branch.repository,
> @@ -3501,8 +3504,8 @@
>
> if remote_extra and not mine_only:
> if printed_local is True:
> - self.outf.write("\n\n\n")
> - self.outf.write("You are missing %d revision(s):\n" %
> + message("\n\n\n")
> + message("You are missing %d revision(s):\n" %
> len(remote_extra))
And this
> for revision in iter_log_revisions(remote_extra,
> remote_branch.repository,
> @@ -3512,15 +3515,15 @@
>
> if mine_only and not local_extra:
> # We checked local, and found nothing extra
> - self.outf.write('This branch is up to date.\n')
> + message('This branch is up to date.\n')
> elif theirs_only and not remote_extra:
> # We checked remote, and found nothing extra
> - self.outf.write('Other branch is up to date.\n')
> + message('Other branch is up to date.\n')
> elif not (mine_only or theirs_only or local_extra or
> remote_extra):
> # We checked both branches, and neither one had extra
> # revisions
> - self.outf.write("Branches are up to date.\n")
> + message("Branches are up to date.\n")
> finally:
> remote_branch.unlock()
> finally:
>
> === modified file 'bzrlib/tests/blackbox/test_missing.py'
> --- bzrlib/tests/blackbox/test_missing.py 2008-08-02 17:10:50 +0000
> +++ bzrlib/tests/blackbox/test_missing.py 2008-10-17 03:01:38 +0000
> @@ -1,6 +1,4 @@
> -# Copyright (C) 2005 Canonical Ltd
> -# -*- coding: utf-8 -*-
> -# vim: encoding=utf-8
> +# Copyright (C) 2005, 2008 Canonical Ltd
> #
> # This program is free software; you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> @@ -28,6 +26,18 @@
>
> class TestMissing(TestCaseWithTransport):
>
> + def test_missing_quiet(self):
> + # <https://bugs.launchpad.net/bzr/+bug/284748>
> + # create a source branch
> + a_tree = self.make_branch_and_tree('.')
> + self.build_tree_contents([('a', 'initial\n')])
> + a_tree.add('a')
> + a_tree.commit(message='initial')
> +
> + out, err = self.run_bzr('missing -q .')
> + self.assertEqual('', out)
> + self.assertEqual('', err)
> +
^- I would probably recommend testing when there actually is something
missing as well.
BB:tweak
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkj4ESgACgkQJdeBCYSNAAPVOQCfcHyLgsvr0PAhHGHZbHqveIHG
BFwAoMv95+9YLvbyQoPtZ9wtDychE9rs
=M1+w
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list