Merge lp:~vila/bzr/638451-malformed into lp:bzr
| Status: | Merged |
|---|---|
| Approved by: | Vincent Ladeuil on 2010-12-03 |
| Approved revision: | 4661 |
| Merged at revision: | 5558 |
| Proposed branch: | lp:~vila/bzr/638451-malformed |
| Merge into: | lp:bzr |
| Diff against target: |
244 lines (+102/-56) 7 files modified
bzrlib/conflicts.py (+31/-0) bzrlib/help_topics/en/conflict-types.txt (+15/-5) bzrlib/tests/blackbox/test_resolve.py (+0/-45) bzrlib/tests/test_conflicts.py (+44/-5) bzrlib/transform.py (+1/-1) doc/en/release-notes/bzr-2.3.txt (+5/-0) doc/en/whats-new/whats-new-in-2.3.txt (+6/-0) |
| To merge this branch: | bzr merge lp:~vila/bzr/638451-malformed |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Vincent Ladeuil | Approve on 2010-12-03 | ||
|
Review via email:
|
|||
This proposal supersedes a proposal from 2010-11-10.
Commit Message
Implement resolve --take-this and --take-other for text conflicts.
Description of the Change
This fixes bug #638451 by implementing resolve --take-this and
--take-other for text conflicts.
From the discussion I went with using the files already produced (and possibly modified by the user), we can implement other actions later.
I've also described the actions taken by --take-this and --take-other for file conflicts in the 'bzr help conflict-types'.
| Martin von Gagern (gagern) wrote : | # |
| Martin von Gagern (gagern) wrote : | # |
Gave the branch a quick test and verified that both my shell script and the blackbox test from my lp:~gagern/bzr/bug638451-resolve-take-other branch work as expected. I've also updated my branch to merge that unscripted blackbox test into the test suite. As scripted tests are far more readable, I wonder whether I should turn it into such a scripted test, or whether you will do so. Currently your branch doesn't seem to actually have a blackbox test for --tahe-this or --take-other, does it?
| Vincent Ladeuil (vila) wrote : | # |
>>>>> Martin von Gagern <email address hidden> writes:
> Gave the branch a quick test and verified that both my shell
> script and the blackbox test from my
> lp:~gagern/bzr/bug638451-resolve-take-other branch work as
> expected.
Great, thanks !
> I've also updated my branch to merge that unscripted blackbox test
> into the test suite. As scripted tests are far more readable, I
> wonder whether I should turn it into such a scripted test, or
> whether you will do so.
> Currently your branch doesn't seem to actually have a blackbox
> test for --tahe-this or --take-other, does it?
No it doesn't, it has whitebox tests for it in
bt.test_
These tests ensures that both --take-this and --take-other are covered as
well as merging both branches in both directions.
I didn't try to write blackbox tests ensuring the same coverage so far
and I'm not sure it would be the right approach. I agree they are more
readable and easier to write for people that doesn't have the needed
knowledge of the bzr internals but in the long run we don't want to
write blackbox tests if more precise tests can be written as they are
harder to debug when they fail (if only because stdin/stdout/stderr are
redirected which forbids using pdb...).
There are still a lot more tests to be written though, for example I
suspect that if the user delete the .OTHER file before running bzr
resolve --take-other bzr will issue a traceback instead of a nicer error
message but there is a related FIXME in bt.test_conflicts about
robustness.
| Neil Martinsen-Burrell (nmb) wrote : | # |
As someone who experienced this bug (or its more recent kin) I can say that what I expected was that "resolve --take-other" would be a direct synonym for "cp file.OTHER file; bzr resolved file". I think that giving a simple meaning to --take-this and --take-other for text conflicts is more valuable than discussing the possibility of a richer set of actions. In the interest of backwards compatibility and simplicity, I think that --take-this and --take-other should retain the simple meanings and other, more complex actions should get new names.
| John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 11/19/2010 9:27 AM, Neil Martinsen-Burrell wrote:
> As someone who experienced this bug (or its more recent kin) I can say that what I expected was that "resolve --take-other" would be a direct synonym for "cp file.OTHER file; bzr resolved file". I think that giving a simple meaning to --take-this and --take-other for text conflicts is more valuable than discussing the possibility of a richer set of actions. In the interest of backwards compatibility and simplicity, I think that --take-this and --take-other should retain the simple meanings and other, more complex actions should get new names.
Just to mention, that *my* belief would be to use the content from the
repository, rather than whatever was on disk. (In case someone modified
the files).
I don't know if that is how other people would see it, though.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkz
sFcAn32GnNw91vh
=LWhY
-----END PGP SIGNATURE-----
| Vincent Ladeuil (vila) wrote : | # |
>>>>> John A Meinel <email address hidden> writes:
> On 11/19/2010 9:27 AM, Neil Martinsen-Burrell wrote:
>> As someone who experienced this bug (or its more recent kin) I can say that what I expected was that "resolve --take-other" would be a direct synonym for "cp file.OTHER file; bzr resolved file". I think that giving a simple meaning to --take-this and --take-other for text conflicts is more valuable than discussing the possibility of a richer set of actions. In the interest of backwards compatibility and simplicity, I think that --take-this and --take-other should retain the simple meanings and other, more complex actions should get new names.
> Just to mention, that *my* belief would be to use the content from the
> repository, rather than whatever was on disk. (In case someone modified
> the files).
Yeah, there is a lot to discuss here.
If the user hasn't modified the .OTHER file, then the end result is the
same (the .OTHER file was created from the repo).
If the user has modified the .OTHER file, then restoring from the repo
will get rid of the user modifications which will be surprising (which
of the two scenarios is the most surprising is open to debate IMHO).
In the end, after conflicts have been resolved, and before committing,
you're supposed to review the result so whatever we implement, the
outcome is still visible to the user.
I'm still slightly prefering taking the .OTHER file over restoring from
the repo as it's more in line with the resolve 'spirit': We don't try to
guess, we just take what the user gives us (the plan is still to
document what --take-other does (whatever we chose)).
Also keep in mind that when 'bzr resolve --take-other' is used, without
any file (and all the related bug reports were cases were people using
that form) essentially means:
- ok, bzr has merged everything it can and left conflicts,
- for those conflicts, the other side is right, take it.
So we are not doing a 'pull --overwrite OTHER', we have merged cleanly
as best as we could. The user may have already resolved some other
conflicts manually (or not) and want to complete his resolution process.
So there is a grey area: the user did "stuff" and we should respect
that.
In my mind taking the file is closer to what GUI conflict handling
allows *inside* a text file with conflicts: you can chose the THIS part
or the OTHER part or both *including* any editing you may have done to
resolve the conflict in a finer way.
All in all, both features make sense and both can implemented as actions
(and both can also be achieved by other means), so we have to decide
which one we implement.
Thanks to all for the feedback anyway and don't forget to vote ;)
| Martin Pool (mbp) wrote : | # |
My expectation is that it would probably come from the repo, even if
you have modified the OTHER file. At any rate that is a reasonable
question so it should be documented.
I think you should mention this in the user guide, under 'resolving
conflicts', even adding a stub of this section if there is not one
already. So 'needsfixing' for docs, at least.
I agree with MvG, we could use --prefer-
This increases the tension about the conflation of:
* update the working copy for a conflicted file
* mark this conflict as having been resolved
* forget this conflict ever occurred
However we can get there later.
--
Martin
| John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 11/23/2010 1:34 AM, Martin Pool wrote:
> My expectation is that it would probably come from the repo, even if
> you have modified the OTHER file. At any rate that is a reasonable
> question so it should be documented.
>
> I think you should mention this in the user guide, under 'resolving
> conflicts', even adding a stub of this section if there is not one
> already. So 'needsfixing' for docs, at least.
>
> I agree with MvG, we could use --prefer-
>
> This increases the tension about the conflation of:
>
> * update the working copy for a conflicted file
> * mark this conflict as having been resolved
> * forget this conflict ever occurred
>
> However we can get there later.
>
I think the best answer to that I've seen so far is to add a new command.
"bzr resolved" to do what 'bzr resolve' does today. (Mark something as
manually resolved.)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkz
HfwAoLHqHcLarXo
=2VoH
-----END PGP SIGNATURE-----
| Martin Pool (mbp) wrote : | # |
On 24 November 2010 01:43, John Arbash Meinel <email address hidden> wrote:
>> This increases the tension about the conflation of:
>>
>> * update the working copy for a conflicted file
>> * mark this conflict as having been resolved
>> * forget this conflict ever occurred
>>
>> However we can get there later.
>>
>
> I think the best answer to that I've seen so far is to add a new command.
>
> "bzr resolved" to do what 'bzr resolve' does today. (Mark something as
> manually resolved.)
I think we do need one command for the first action, and one for the
other two. I don't think we should have those commands differ only in
grammatical tense or only by one letter.
--
Martin
| Vincent Ladeuil (vila) wrote : | # |
Ping
| Vincent Ladeuil (vila) wrote : | # |
<poolie> it looks basically ok
<poolie> so, weak +1 if you're confident to merge it
- 4660. By Vincent Ladeuil on 2010-12-03
-
Merge cleanup into 638451-malformed
- 4661. By Vincent Ladeuil on 2010-12-03
-
Fix the news entry.
| Vincent Ladeuil (vila) wrote : | # |
sent to pqm by email

I'd like "resolve --take-this name" with its old semantics. To me it means "take name.THIS, discarding the files name.OTHER, name.BASE and name". It's a shorthand for a manual copy followed by a resolve.
I think the alternative you suggest makes some sense as well, in particular for file formats I prefer to edit with an application different from a text editor. But you'll have to examine the file for reproducable results: a more intelligent merger might in the future merge things successfully that fail to merge today, leading to different behaviour in this case.
I think the current --take-this should keep its name for the sake of backwards compatibility as well. Perhaps --prefer-this would be an option for adding the other approach one day.
Given that such an option would have to parse the current file in order to identify which changes have been merged and which haven't, I'm not sure I'd always trust its output. Perhaps for this reason you'd rather want this an option to remerge than to resolve. The workflow I've got in mind would be: take}-this (decides on conflicting regions)
merge (reports difference)
optionally examine file (see where the changes are, what to look for later on)
remerge --{prefer|
examine result (e.g. open in app, check XML wellformedness, or something like this)
resolve (takes the file off my TODO)
commit.