Merge lp:~vila/bzr/401599-strict-warnings into lp:bzr
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Merged at revision: | not available | ||||
| Proposed branch: | lp:~vila/bzr/401599-strict-warnings | ||||
| Merge into: | lp:bzr | ||||
| Diff against target: |
253 lines (+58/-47) (has conflicts) 8 files modified
NEWS (+7/-0) bzrlib/builtins.py (+4/-2) bzrlib/foreign.py (+4/-2) bzrlib/mutabletree.py (+11/-6) bzrlib/send.py (+4/-2) bzrlib/tests/blackbox/test_dpush.py (+0/-18) bzrlib/tests/blackbox/test_push.py (+23/-16) bzrlib/tests/blackbox/test_send.py (+5/-1) Text conflict in NEWS |
||||
| To merge this branch: | bzr merge lp:~vila/bzr/401599-strict-warnings | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Andrew Bennetts | 2010-04-22 | Needs Fixing on 2010-04-28 | |
|
Review via email:
|
|||
Description of the Change
Thanks for the heads-up John.
This patch fixes the warning message displayed when we handle --strict/
for dpush, push and send. The additional part mentioniing --no-strict should only be
mentioned if --strict is used (or the conf variable set to True), *not* when we just
display the warning.
Note that tests have not been updated since they were testing the correct behaviour.
- 5173. By Vincent Ladeuil on 2010-04-22
-
Explain that the uncommitted changes are not processed when
issuing the warning.* bzrlib/
mutabletree. py:
(MutableTree.check_changed_ or_out_ of_date) : Use diferent 'more'
arguments depending on whether we issue a warning or an error.* bzrlib/send.py:
(send): Add the more_warnings argument when calling
check_changed_or_out_ of_date. * bzrlib/foreign.py:
(cmd_dpush.run): Add the more_warnings argument when calling
check_changed_or_out_ of_date. * bzrlib/builtins.py:
(cmd_push.run): Add the more_warnings argument when calling
check_changed_or_out_ of_date.
- 5174. By Vincent Ladeuil on 2010-04-28
-
Fixed as per Andrew's review.
* bzrlib/
tests/blackbox/ test_push. py:
(TestPushStrictMixin.assertPus hFails) : Ensure that the error
message mentions --no-strict.
(TestPushStrictMixin.assertPus hSucceeds) : Rely on branches only to
satisfy dpush needs. Check the warning in the error message.* bzrlib/
tests/blackbox/ test_dpush. py:
(TestDpushStrictMixin) : Simplified now that the base class do less
assumptions.
| Vincent Ladeuil (vila) wrote : | # |
>>>>> Andrew Bennetts <email address hidden> writes:
> Review: Needs Fixing
> +* Wrong section, should be 2.2b3, should be fixed at merge.
> Don't forget to fix this bit!
Sure. By the way, how could your news_merge plugin help here ? For
branches started before a release but that needs to land after a release
(or more generally for daggy-fix branches) it would be nice to have a
way defined workflow that can be merged automatically. One possible way
is to define a fictional "merge target" release and create an entry
there may be ?
> Other than that, the changes here look ok. However, your cover letter says:
>> Note that tests have not been updated since they were testing the correct behaviour.
> Presumably this also means there are tests missing? i.e. that the
> incorrect behaviour does not happen?
No, that part is covered. The missing bit is about the precise content
of the message.
> e.g. shouldn't assertPushSucceeds explicitly assert that no
> warnings are emitted when with_warnings=
> assertEquals('', stderr)? Or maybe assertNotContai
> 'Warning').
Right, I'm not a big fan of assertContainsRe usually, but in this case,
trying to build the full error ouput is far too messy ('Created new
branch' for push, 'Pushed up to revision n' for dpush), so: Done.
I've simplified TestDpushStrict
> I think it would be good for the blackbox tests to default to
> asserting commands don't emit warnings.
| Andrew Bennetts (spiv) wrote : | # |
Vincent Ladeuil wrote:
> >>>>> Andrew Bennetts <email address hidden> writes:
>
> > Review: Needs Fixing
> > +* Wrong section, should be 2.2b3, should be fixed at merge.
>
> > Don't forget to fix this bit!
>
> Sure. By the way, how could your news_merge plugin help here ? For
> branches started before a release but that needs to land after a release
> (or more generally for daggy-fix branches) it would be nice to have a
> way defined workflow that can be merged automatically. One possible way
> is to define a fictional "merge target" release and create an entry
> there may be ?
news_merge can't help with that yet. news_merge would need some way to
know “this addition from OTHER should always be added to the latest
release”. I'm not sure if that should be done in the source branch (by
putting the new text in a placeholder release as you suggest), or by
configuration in PQM's bzr to say “news_merge should always add new
entries to top release of this branch's NEWS”, or something else.
> > Other than that, the changes here look ok. However, your cover letter says:
>
> >> Note that tests have not been updated since they were testing the correct behaviour.
>
> > Presumably this also means there are tests missing? i.e. that the
> > incorrect behaviour does not happen?
>
> No, that part is covered. The missing bit is about the precise content
> of the message.
I don't understand: if this was already covered, then the tests in trunk
should have been failing. They weren't failing, so therefore it's not
covered.
As a concrete example, test_push was *not* asserting that certain
invocations should be warning-free (only that certain other invocations
with warnings included a particular warning).
As I understand it, if no warnings or errors are expected from push,
then stderr should be empty, right? So assertPushSucceeds ought to just
assert that directly, rather than that hoping it knows about all the
likely warnings it should search for in stderr. And if it *does* expect
warnings, perhaps it can assert that every line of stderr matches an
expected warning, so that additional (and thus unexpected) warnings will
fail the test.
| Robert Collins (lifeless) wrote : | # |
+1
| Robert Collins (lifeless) wrote : | # |
Arrgh - +1 to Andrew's comment, I meant.
| Vincent Ladeuil (vila) wrote : | # |
>>>>> Andrew Bennetts <email address hidden> writes:
<snip/>
>>
>> No, that part is covered. The missing bit is about the precise
>> content of the message.
> I don't understand: if this was already covered, then the tests in
> trunk should have been failing. They weren't failing, so
> therefore it's not covered.
No, the behavior has always been correct, that's why the tests never
failed.
But as John mentioned in the bug, the message were misleading.
> As a concrete example, test_push was *not* asserting that certain
> invocations should be warning-free (only that certain other
> invocations with warnings included a particular warning).
That part wasn't covered, the exact messages weren't checked, that's
what the bug was about.
> As I understand it, if no warnings or errors are expected from push,
> then stderr should be empty, right?
No, stderr still contains 'Created new branch' for push and ... I said
that already :-/
> So assertPushSucceeds ought to just assert that directly, rather
> than that hoping it knows about all the likely warnings it should
> search for in stderr.
I think I don't understand you there, may be you should try it yourself ?
I tried to build the full expected output for the errors and ended up
with a far more complicated version that didn't bring any additional
benefit.
The version I've landed:
- ensure the behavior is correct (well, I didn't really change that
except to reduce code duplication for dpush),
- ensure that the warning is absent/present when needed,
- ensure that the '--no-strict' part is mentioned when needed
> And if it *does* expect warnings, perhaps it can assert that every
> line of stderr matches an expected warning, so that additional
> (and thus unexpected) warnings will fail the test.
The actual tests are focused, making them depend on 'Created new branch'
or 'Pushed up to revision n' will just make them more brittle against
unrelated changes. I.e. they will fail for the wrong reason.
| Andrew Bennetts (spiv) wrote : | # |
For the sake of curious onlookers:
We talked on IRC: there's some confusion in this discussion is that I considered what warnings are emitted to the user to be "behaviour", and Vincent didn't.

+* Wrong section, should be 2.2b3, should be fixed at merge.
Don't forget to fix this bit!
Other than that, the changes here look ok. However, your cover letter says:
> Note that tests have not been updated since they were testing the correct behaviour.
Presumably this also means there are tests missing? i.e. that the incorrect behaviour does not happen?
e.g. shouldn't assertPushSucceeds explicitly assert that no warnings are emitted when with_warnings= False, perhaps by assertEquals('', stderr)? Or maybe assertNotContai nsRe(stderr, 'Warning').
I think it would be good for the blackbox tests to default to asserting commands don't emit warnings.