Merge lp:~guilhem-bichot/bzr/bzr-pull-verbose-shows-tip-before-pull into lp:bzr
- bzr-pull-verbose-shows-tip-before-pull
- Merge into bzr.dev
Status: | Work in progress |
---|---|
Proposed branch: | lp:~guilhem-bichot/bzr/bzr-pull-verbose-shows-tip-before-pull |
Merge into: | lp:bzr |
Diff against target: |
158 lines (+101/-2) 3 files modified
NEWS (+34/-0) bzrlib/builtins.py (+19/-2) bzrlib/tests/blackbox/test_pull.py (+48/-0) |
To merge this branch: | bzr merge lp:~guilhem-bichot/bzr/bzr-pull-verbose-shows-tip-before-pull |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Vincent Ladeuil | Approve | ||
John A Meinel | Approve | ||
Review via email: mp+15741@code.launchpad.net |
Commit message
Description of the change
Vincent Ladeuil (vila) wrote : | # |
Thanks for working on that !
This looks quite good but I've made a few tweaks at
lp:~bzr/bzr/bzr-pull-verbose-shows-tip-before-pull :
- both the revno and the revid are displayed,
- the tests use predefined revids to simplify their writing,
- I remove the test checking the *absence* of the message when not using -v
(other tests will (or should !) fail if we do),
- I add one checking that the message is not displayed if nothing is pulled
I can add them when merging (they sounded easier to do than to describe but I think
you may be interested), but it would be easier for the second reviewer if you can merge
them to your branch, modifying them as you see fit of course and push the result
(you won't need to resubmit, just leave a comment so we know the proposal has been updated).
Also, can you complete a contributor agreement?
<http://
Finally, if the second reviewer agrees on that patch, it may be worth doing the same for push, but that can be another submission.
- 4784. By Guilhem Bichot <email address hidden>
-
merged Vincent Ladeuil corrections.
GuilhemBichot (guilhem-bichot) wrote : | # |
Bonjour Vincent. Thanks for the updates, I merged them in my branch (only fixed a typo in NEWS and added a comma there). Regarding "other tests will (or should !) fail if we do" yes two tests would fail as I verified.
I'll get started on the contributor agreement.
Regarding doing the same for "push", do you mean printing the revid of the target branch before the push occurs? Is that info easily available to the push-er?
Vincent Ladeuil (vila) wrote : | # |
> Bonjour Vincent. Thanks for the updates, I merged them in my branch (only
> fixed a typo in NEWS and added a comma there).
There are conflicts there but they can be solved at merge time.
> Regarding "other tests will (or
> should !) fail if we do" yes two tests would fail as I verified.
Great, thanks for checking !
> I'll get started on the contributor agreement.
Thanks.
> Regarding doing the same for "push", do you mean printing the revid of the
> target branch before the push occurs? Is that info easily available to the
> push-er?
It should since that's how we know what to push, if it's not available already, a call to last_revision_info on the remote branch should tell you.
But let's land this patch first.
GuilhemBichot (guilhem-bichot) wrote : | # |
I have a second thought, and suggest that printing revno can be misleading.
A revision can have its revno changed by a pull, for example: I pull the parent branch PB; right after that the tip is the revision of revid R, of revno 10. Some time passes. Someone else merges PB into his own branch and pushes the result into PB (assume no append_
Now I pull PB into my local branch; "bzr pull -v" prints that the tip is (revno 10, revid R). After the pull I find that this pull introduced a bug, I want to revert; if I do:
bzr revert -r revno:10
then I'm going to revert to S, which wasn't the intention: I wanted to revert to the tip before pulling: R.
So I suggest printing only the revid. What do you think?
Vincent Ladeuil (vila) wrote : | # |
I think you can get bitten once and you learn how valuable a trunk with
append_
with a branch shared between several devs that doesn't try to preserve
a linear history on that branch.
Trying to revnos in such a context is bound to fail.
As a UI rule, we don't show revids until required, I think this patch deserves
the exception (but it's activated by -v so one can argue that it's required :)
since some branches doesn't have a linear history, but not
displaying the revno at all, will be a violation of this rule.
Vincent Ladeuil (vila) wrote : | # |
Trying to *use* revnos in such a context is bound to fail.
GuilhemBichot (guilhem-bichot) wrote : | # |
Bonjour Vincent. Yes using append_
Yes our devs should know that revnos are unreliable in our case, and some do know. I was more worried about the case where one forgets about this; it's not so easy to remember that the revno which "bzr pull -v" prints at the end of its execution is already out-of-date when it's printed (i.e. is unusable).
But if there is a UI rule that the revno has to be displayed... case is closed, let's print it :-)
John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
GuilhemBichot wrote:
> Bonjour Vincent. Yes using append_
> Yes our devs should know that revnos are unreliable in our case, and some do know. I was more worried about the case where one forgets about this; it's not so easy to remember that the revno which "bzr pull -v" prints at the end of its execution is already out-of-date when it's printed (i.e. is unusable).
> But if there is a UI rule that the revno has to be displayed... case is closed, let's print it :-)
So one option is to look up the revno *after* pull has completed. It
will be a bit slower if the revno ends up being a merge revision, but
you should be able to do:
old_rev_revno = branch.
That was actually the recommendation back when we discussed this in the
past.
And in fact, we would rather show that then the revision_id (we
generally avoid showing revision-ids in the UI where a revno can be
used.) I think it would be great to log it via mutter(). But showing it
to the user should be avoided.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAks
/oEAnRqTtExNqpu
=kKt+
-----END PGP SIGNATURE-----
John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John A Meinel wrote:
> GuilhemBichot wrote:
>> Bonjour Vincent. Yes using append_
>> Yes our devs should know that revnos are unreliable in our case, and some do know. I was more worried about the case where one forgets about this; it's not so easy to remember that the revno which "bzr pull -v" prints at the end of its execution is already out-of-date when it's printed (i.e. is unusable).
>> But if there is a UI rule that the revno has to be displayed... case is closed, let's print it :-)
>
> So one option is to look up the revno *after* pull has completed. It
> will be a bit slower if the revno ends up being a merge revision, but
> you should be able to do:
>
> old_rev_revno = branch.
>
> That was actually the recommendation back when we discussed this in the
> past.
>
> And in fact, we would rather show that then the revision_id (we
> generally avoid showing revision-ids in the UI where a revno can be
> used.) I think it would be great to log it via mutter(). But showing it
> to the user should be avoided.
>
> John
> =:->
>
You might try:
lp:///~jameinel/bzr/2.1.0b4-pull-v
Which changes it to do exactly as I mentioned. This means that you get:
Tip revision before pull was: 1.1.4
Which means:
1) We don't have to show the revision-id, because you can get back to
the original revno in the new context.
2) Changes mutter to put something like this into .bzr.log:
0.545 In branch C:/Users/
from revid:<email address hidden>
=> revid:<email address hidden>
We *could* put the revnos in there, but I'm fine with revids in the log
file.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAks
LOAAn25qylFRDLQ
=Y+L2
-----END PGP SIGNATURE-----
GuilhemBichot (guilhem-bichot) wrote : | # |
Hi John. I'm fine with your changes. Two comments:
- do we really need to initialize "result" to None?
- the place where you print to stdout is before listing all pulled revisions (log.show_
long list of changed files
tip before pull
long list of pulled revisions.
I find that the tip gets drawn in the middle of those two lists, and requires a long scrolling up the shell window in order to be found. I liked printing it after the list of pulled revisions, it was easier to spot.
John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
GuilhemBichot wrote:
> Hi John. I'm fine with your changes. Two comments:
> - do we really need to initialize "result" to None?
> - the place where you print to stdout is before listing all pulled revisions (log.show_
> long list of changed files
> tip before pull
> long list of pulled revisions.
> I find that the tip gets drawn in the middle of those two lists, and requires a long scrolling up the shell window in order to be found. I liked printing it after the list of pulled revisions, it was easier to spot.
I had originally put it at the very end, but there was a test that
asserts that it is before the list of new revisions (but not before the
old revs?)
We don't need to set result to None, that was done when I put the mutter
in a finally statement, and found it broke when there was a problem with
the pull.
I don't really care where the info goes, feel free to move it around. It
was more about the content of the message than where it was put.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAks
FggAn1JZtUA4BR/
=vKnt
-----END PGP SIGNATURE-----
GuilhemBichot (guilhem-bichot) wrote : | # |
I merged your changes, removed "result = None", changed the printing order (not yet ran the testsuite and not yet committed); regarding this comment:
# Encode target because it may have non-ascii characters, and
# so can the revids.
A simple test says that before running "encode()", target is a unicode string (ok) but result.
John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
GuilhemBichot wrote:
> I merged your changes, removed "result = None", changed the printing order (not yet ran the testsuite and not yet committed); regarding this comment:
> # Encode target because it may have non-ascii characters, and
> # so can the revids.
> target = target.
> A simple test says that before running "encode()", target is a unicode string (ok) but result.
Revision ids are defined as utf-8 encoded strings. (*never* unicode.) So
we don't want to mix non-ascii utf-8 strings with Unicode as it causes
python to try to decode them as ascii. (Now it turns out that in
practice 99% of all revision-ids are pure ascii, but that isn't the api
definition.)
So the comment stands. :)
mutter() is taking them as 8-bit (utf-8) strings, which should be fine.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAks
kykAnRieLvBtdH8
=2K6c
-----END PGP SIGNATURE-----
GuilhemBichot (guilhem-bichot) wrote : | # |
Hello John. Thanks much about the explanation about encoding of revids, I had mixed things a bit :-)
This test fails:
./bzr selftest -v bzrlib.
with this error:
Traceback (most recent call last):
File "/home/
out = self.run_bzr('pull --overwrite --verbose ../a')[0]
File "/home/
working_
File "/home/
encoding=
File "/home/
args)
File "/home/
return a_callable(*args, **kwargs)
File "/home/
return run_bzr(argv)
File "/home/
ret = run(*run_argv)
File "/home/
return self.run(
File "/home/
result.
File "/home/
result = unbound(self, *args, **kwargs)
File "/home/
return self._do_
File "/home/
raise errors.
NoSuchRevision: BzrBranch7(
The reason is that this is a pull *--overwrite*, so this new code:
fails, because the branch after pull doesn't have this revid anymore (it was overwritten).
I see two solutions:
1) print the revid (even though it's not in the branch anymore, it can still be used to recreate the past branch from another location)
2) print a message saying that the old revision is not there anymore (less helpful but does not violate UI policies).
John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
GuilhemBichot wrote:
> Hello John. Thanks much about the explanation about encoding of revids, I had mixed things a bit :-)
> This test fails:
> ./bzr selftest -v bzrlib.
> with this error:
...
> raise errors.
> NoSuchRevision: BzrBranch7(
>
> The reason is that this is a pull *--overwrite*, so this new code:
> old_dotted_revno = branch_
> result.old_revid)
> fails, because the branch after pull doesn't have this revid anymore (it was overwritten).
> I see two solutions:
> 1) print the revid (even though it's not in the branch anymore, it can still be used to recreate the past branch from another location)
> 2) print a message saying that the old revision is not there anymore (less helpful but does not violate UI policies).
Sorry, I meant to test this case and forgot about it by the end of it.
I could go either way. We do have '--show-ids' and 'bzr uncommit' does
show the revid because the revision cannot be accessed by any other means.
So probably show "revid:..." since that is consistent enough with
uncommit and others. (Only show revids when there isn't another way.)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAks
ZbUAmwfQ9Cz6ySX
=p3ak
-----END PGP SIGNATURE-----
GuilhemBichot (guilhem-bichot) wrote : | # |
Hi John. By "Only show revids when there isn't another way" do you mean that "bzr pull -v" should display the old tip's revid only if this revision isn't present in the branch anymore?
Or do you mean that we should just print revid of old and new tips, and no revnos, no matter if the old revision exists or not? Or something else (if you have an example)?
John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
GuilhemBichot wrote:
> Hi John. By "Only show revids when there isn't another way" do you mean that "bzr pull -v" should display the old tip's revid only if this revision isn't present in the branch anymore?
> Or do you mean that we should just print revid of old and new tips, and no revnos, no matter if the old revision exists or not? Or something else (if you have an example)?
Print the dotted revno unless the old tip is no longer in the history,
then display revid:...
Just catch the exception, and print a different message indicating that
the old revision isn't in the ancestry any more, and this is what it was.
I'll put a simple example in my branch:
> === modified file 'bzrlib/
> --- bzrlib/builtins.py 2009-12-08 17:48:04 +0000
> +++ bzrlib/builtins.py 2009-12-09 17:29:36 +0000
> @@ -1031,11 +1031,16 @@
> % (target, result.old_revid, result.new_revid))
> result.
> if verbose and result.old_revid != result.new_revid:
> - old_dotted_revno = branch_
> - result.old_revid)
> - old_dotted_revno = '.'.join([str(i) for i in old_dotted_revno])
> - self.outf.
> - % (old_dotted_
> + try:
> + old_revno_in_to = branch_
> + result.old_revid)
> + old_revstr = '.'.join([str(i) for i in old_revno_in_to])
> + except errors.
> + self.outf.
> + ' Was revid:%s\n' % (result.
> + else:
> + self.outf.
> + % (old_revstr,))
> log.show_
> branch_to, self.outf, result.old_revno,
> result.old_revid)
>
> === modified file 'bzrlib/
> --- bzrlib/
> +++ bzrlib/
> @@ -415,6 +415,23 @@
> out = self.run_bzr('pull -d target -v')[0]
> self.assertCont
>
> + def test_pull_
> + builder = self.make_
> + builder.
> + builder.
> + ('add', ('', 'TREE_ROOT', 'directory', None))])
> + builder.
> + builder.
> + builder.
> + builder.
> + b = builder.
> + b.lock_write()
> + self.addCleanup
> + b.bzrdir.
> + out = self.run_...
GuilhemBichot (guilhem-bichot) wrote : | # |
Thanks John. I merged your changes above, only changed the phrasing of "Tip revision no longer in ancestry", like this:
- self.outf.
+ self.outf.
Tests work fine. I have nothing to add.
By the way, this whole patch has received so many changes from you and Vincent that it would deserve your names in the NEWS entry.
John A Meinel (jameinel) wrote : | # |
If I understand this, you changed it to put the 'tip revision was' message at the very end. For whatever reason I thought you wanted to put it before all of the log messages.
Anyway, I'm fine with this.
GuilhemBichot (guilhem-bichot) wrote : | # |
yes, I put it at the end and I forgot to mention this change, sorry. I found that putting it before the log messages would make it almost invisible when there is more than a screen long of log messages (frequent case with pulls that I do).
Vincent Ladeuil (vila) wrote : | # |
Well done ! I'll merge.
Vincent Ladeuil (vila) wrote : | # |
That is, as soon as we get your contributor agreement:
<http://
GuilhemBichot (guilhem-bichot) wrote : | # |
yes, let's put this into dormant state until I manage to sign this agreement (need to consult Sun first).
John A Meinel (jameinel) wrote : | # |
Have you managed to work out an agreement yet? It would be nice to have this in 2.1.
GuilhemBichot (guilhem-bichot) wrote : | # |
I will have to look at the agreement only later - alas.
Regarding the patch: how about enabling the printout even without -v? I find this is just a line, so not really verbose...
John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
GuilhemBichot wrote:
> I will have to look at the agreement only later - alas.
> Regarding the patch: how about enabling the printout even without -v? I find this is just a line, so not really verbose...
I believe other commands (like update) similarly print out what revision
you end up on when the command completes. I think if we incorporate that
so that we have "pulled from X to Y" as the information line, it would
be fine to include that even when -v is not supplied.
A partial concern is that computing a dotted revno is potentially
expensive on large projects. However, it isn't expected to happen often,
so the tradeoff is probably ok.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkt
EOkAnj+
=Y+ko
-----END PGP SIGNATURE-----
Unmerged revisions
- 4787. By Guilhem Bichot <email address hidden>
-
an attempt at a clearer message.
- 4786. By Guilhem Bichot <email address hidden>
-
merging changes from John Arbash Meinel
- 4785. By Guilhem Bichot <email address hidden>
-
merge changes from John Arbash Meinel.
- 4784. By Guilhem Bichot <email address hidden>
-
merged Vincent Ladeuil corrections.
- 4783. By Guilhem Bichot <email address hidden>
-
In "bzr pull":
- show the tip revision of the destination branch before pulling, if --verbose and something was pulled
- write it to .bzr.log, unconditionally.
Interest: If a pull brings in some bug, the printed revision can serve as a point to revert to;
if a pull brings in some new revisions to review, the printed revision can serve as a low bound for what
revisions to review.
Preview Diff
1 | === modified file 'NEWS' |
2 | --- NEWS 2009-12-09 17:21:54 +0000 |
3 | +++ NEWS 2009-12-09 21:59:12 +0000 |
4 | @@ -8,6 +8,7 @@ |
5 | bzr 2.1.0b4 (not released yet) |
6 | ############################## |
7 | |
8 | +<<<<<<< TREE |
9 | :Codename: san francisco airport |
10 | :2.1.0b4: ??? |
11 | |
12 | @@ -261,6 +262,39 @@ |
13 | |
14 | * -Dhpssvfs will now trigger on ``RemoteBzrDir._ensure_real``, providing |
15 | more debugging of VFS access triggers. (Robert Collins) |
16 | +======= |
17 | +:Codename: |
18 | +:2.1.0b3: ??? |
19 | + |
20 | +Compatibility Breaks |
21 | +******************** |
22 | + |
23 | +New Features |
24 | +************ |
25 | + |
26 | +* ``bzr pull -v`` now displays the tip revision before the pull |
27 | + occurred, to make it easier to rollback if needed. This is also |
28 | + unconditionally recorded in ``.bzr.log``. |
29 | + (Guilhem Bichot) |
30 | + |
31 | +Bug Fixes |
32 | +********* |
33 | + |
34 | +Improvements |
35 | +************ |
36 | + |
37 | +Documentation |
38 | +************* |
39 | + |
40 | +API Changes |
41 | +*********** |
42 | + |
43 | +Internals |
44 | +********* |
45 | + |
46 | +Testing |
47 | +******* |
48 | +>>>>>>> MERGE-SOURCE |
49 | |
50 | * KnownFailure is now signalled to ``ExtendedTestResult`` using the same |
51 | method that Python 2.7 uses - ``addExpectedFailure``. (Robert Collins) |
52 | |
53 | === modified file 'bzrlib/builtins.py' |
54 | --- bzrlib/builtins.py 2009-12-09 08:38:02 +0000 |
55 | +++ bzrlib/builtins.py 2009-12-09 21:59:12 +0000 |
56 | @@ -939,7 +939,8 @@ |
57 | _see_also = ['push', 'update', 'status-flags', 'send'] |
58 | takes_options = ['remember', 'overwrite', 'revision', |
59 | custom_help('verbose', |
60 | - help='Show logs of pulled revisions.'), |
61 | + help="Show logs of pulled revisions, show destination branch's" |
62 | + " tip before pulling."), |
63 | Option('directory', |
64 | help='Branch to pull into, ' |
65 | 'rather than the one containing the working directory.', |
66 | @@ -969,7 +970,7 @@ |
67 | except errors.NoWorkingTree: |
68 | tree_to = None |
69 | branch_to = Branch.open_containing(directory)[0] |
70 | - |
71 | + |
72 | if local and not branch_to.get_bound_location(): |
73 | raise errors.LocalRequiresBoundBranch() |
74 | |
75 | @@ -1029,11 +1030,27 @@ |
76 | result = branch_to.pull( |
77 | branch_from, overwrite, revision_id, local=local) |
78 | |
79 | + target = urlutils.unescape_for_display(branch_to.base, 'utf-8') |
80 | + # Encode target because it may have non-ascii characters, and |
81 | + # so can the revids. |
82 | + target = target.encode('utf-8') |
83 | + mutter('In branch %s pulled\n from revid:%s\n => revid:%s' |
84 | + % (target, result.old_revid, result.new_revid)) |
85 | result.report(self.outf) |
86 | if verbose and result.old_revid != result.new_revid: |
87 | log.show_branch_change( |
88 | branch_to, self.outf, result.old_revno, |
89 | result.old_revid) |
90 | + try: |
91 | + old_revno_in_to = branch_to.revision_id_to_dotted_revno( |
92 | + result.old_revid) |
93 | + old_revstr = '.'.join([str(i) for i in old_revno_in_to]) |
94 | + except errors.NoSuchRevision: |
95 | + self.outf.write('Tip revision before pull is no longer in this branch.' |
96 | + ' Was revid:%s\n' % (result.old_revid,)) |
97 | + else: |
98 | + self.outf.write('Tip revision before pull was: %s\n' |
99 | + % (old_revstr,)) |
100 | finally: |
101 | branch_to.unlock() |
102 | finally: |
103 | |
104 | === modified file 'bzrlib/tests/blackbox/test_pull.py' |
105 | --- bzrlib/tests/blackbox/test_pull.py 2009-06-15 06:47:14 +0000 |
106 | +++ bzrlib/tests/blackbox/test_pull.py 2009-12-09 21:59:12 +0000 |
107 | @@ -391,3 +391,51 @@ |
108 | remote = Branch.open('stacked') |
109 | self.assertEndsWith(remote.get_stacked_on_url(), '/parent') |
110 | |
111 | + def test_pull_verbose_prints_tip_before_pull(self): |
112 | + parent = self.make_branch_and_tree('parent') |
113 | + rev1 = parent.commit(message='first commit', rev_id='number-one') |
114 | + rev2 = parent.commit(message='second commit', rev_id='number-two') |
115 | + parent.bzrdir.sprout('branch', revision_id=rev1) |
116 | + out = self.run_bzr('pull -d branch -v')[0] |
117 | + self.assertContainsRe(out, 'Tip revision before pull was: 1') |
118 | + |
119 | + def test_pull_verbose_prints_dotted_tip(self): |
120 | + builder = self.make_branch_builder('source') |
121 | + builder.start_series() |
122 | + builder.build_snapshot('A', None, [ |
123 | + ('add', ('', 'TREE_ROOT', 'directory', None))]) |
124 | + builder.build_snapshot('B', ['A'], []) |
125 | + builder.build_snapshot('C', ['B'], []) |
126 | + builder.build_snapshot('D', ['A', 'C'], []) |
127 | + builder.finish_series() |
128 | + b = builder.get_branch() |
129 | + b.lock_write() |
130 | + self.addCleanup(b.unlock) |
131 | + b.bzrdir.sprout('target', revision_id='C') |
132 | + out = self.run_bzr('pull -d target -v')[0] |
133 | + self.assertContainsRe(out, 'Tip revision before pull was: 1.1.2') |
134 | + |
135 | + def test_pull_verbose_prints_not_in_ancestry_tip(self): |
136 | + builder = self.make_branch_builder('source') |
137 | + builder.start_series() |
138 | + builder.build_snapshot('A', None, [ |
139 | + ('add', ('', 'TREE_ROOT', 'directory', None))]) |
140 | + builder.build_snapshot('B', ['A'], []) |
141 | + builder.build_snapshot('C', ['B'], []) |
142 | + builder.build_snapshot('D', ['A', 'B'], []) |
143 | + builder.finish_series() |
144 | + b = builder.get_branch() |
145 | + b.lock_write() |
146 | + self.addCleanup(b.unlock) |
147 | + b.bzrdir.sprout('target', revision_id='C') |
148 | + out = self.run_bzr('pull -d target -v --overwrite')[0] |
149 | + self.assertContainsRe(out, 'Tip revision before pull is no longer in' |
150 | + ' this branch. Was revid:C') |
151 | + |
152 | + def test_pull_verbose_does_not_print_tip_when_nothing_is_pulled(self): |
153 | + parent = self.make_branch_and_tree('parent') |
154 | + rev1 = parent.commit(message='first commit', rev_id='number-one') |
155 | + rev2 = parent.commit(message='second commit', rev_id='number-two') |
156 | + parent.bzrdir.sprout('branch', revision_id=rev2) |
157 | + out = self.run_bzr('pull -d branch -v')[0] |
158 | + self.assertNotContainsRe(out, 'Tip revision before pull was') |
In "bzr pull":
- show the tip revision of the destination branch before pulling, if --verbose and something was pulled
- write it to .bzr.log, unconditionally.
Interest: If a pull brings in some bug, the printed revision can serve as a point to revert to;
if a pull brings in some new revisions to review, the printed revision can serve as a low bound for what
revisions to review.
Printing to stdout is convenient; printing to .bzr.log survives a bit longer (useful if you discover a bug in the pulled revisions only after some time).
Could somebody please give some feedback?