Merge lp:~gz/bzr/resolve_file_not_done into lp:bzr

Proposed by Martin Packman on 2012-07-27
Status: Needs review
Proposed branch: lp:~gz/bzr/resolve_file_not_done
Merge into: lp:bzr
Prerequisite: lp:~gz/bzr/resolve_auto_refactor
Diff against target: 171 lines (+30/-21)
3 files modified
bzrlib/conflicts.py (+5/-7)
bzrlib/help_topics/en/conflict-types.txt (+4/-3)
bzrlib/tests/test_conflicts.py (+21/-11)
To merge this branch: bzr merge lp:~gz/bzr/resolve_file_not_done
Reviewer Review Type Date Requested Status
bzr-core 2012-07-27 Pending
Review via email: mp+117052@code.launchpad.net

Description of the Change

Makes `bzr resolve FILE` use the same auto logic as `bzr resolve` rather than implying `bzr resolve --done FILE`.

This was discussed on the mailing list recently:

<https://lists.ubuntu.com/archives/bazaar/2012q3/075039.html>

Currently auto is pretty limited, which makes this change less appetizing, for deleted directories and such like I often end up running resolve with single argument quite often, and having to remember --done now could get frustrating. However, it's pretty obvious if you know about the change, and making auto smarter is something we've wanted for a while anyway.

I've updated some bits of documentation but am probably missing other bits elsewhere.

The current testing for conflicts I don't fully understand, some help explaining the details there would be good, but it appears that several places where I needed to add --done should get covered by making --auto smarter.

To post a comment you must log in.
Aaron Bentley (abentley) wrote :

I think that the existing behaviour makes sense, and the proposed changes just cause users to do more typing.

They encourage users to use "resolve FILE" when bzr doesn't need an argument, and they force users to specify --done when they actually do need to specify an argument.

Why have you removed documentation of --all at 19?

Martin Packman (gz) wrote :

> I think that the existing behaviour makes sense, and the proposed changes just
> cause users to do more typing.

I agree, the extra typing is bad.

My aim with this group of branches is to actually not change what you have to type. This branch makes it harder to just discard conflicts, in others I want to make detection of resolved conflicts actually work for more cases. So, in the end you'll still be doing some action to resolve a conflict, then `bzr resolve FILE`.. or just `bzr resolve`.

> Why have you removed documentation of --all at 19?

Should have left that for another branch really but, in short, `bzr resolve --all` is functionally equivalent to `bzr resolve --done`, which is a more dangerous operation than we want to recommend in the help text.

People should be using `bzr resolve` followed by `bzr resolve --done FILE` if the auto resolution fails for something in particular. Generalising to the no-arg form for all files is easy to understand from there for when it's actually useful.

Unmerged revisions

6549. By Martin Packman on 2012-07-27

Note in cmd_resolve help that --done is needed, and remove mention of --all

6548. By Martin Packman on 2012-07-27

Make 'auto' the default in resolve_action_registry

6547. By Martin Packman on 2012-07-27

Update conflict-types help for change to resolve semantics

6546. By Martin Packman on 2012-07-27

Make resolving with a list of files default to action auto rather than done

6545. By Martin Packman on 2012-07-27

Deprecate WorkingTree.auto_resolve

6544. By Martin Packman on 2012-07-27

Refactor auto_resolve tree method into auto action on conflicts

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/conflicts.py'
2--- bzrlib/conflicts.py 2012-07-27 12:34:38 +0000
3+++ bzrlib/conflicts.py 2012-07-27 12:34:38 +0000
4@@ -92,7 +92,8 @@
5 resolve_action_registry.register(
6 'take-other', 'take_other',
7 'Resolve the conflict taking the merged version into account.')
8-resolve_action_registry.default_key = 'done'
9+resolve_action_registry.default_key = 'auto'
10+
11
12 class ResolveActionOption(option.RegistryOption):
13
14@@ -112,8 +113,8 @@
15 before you can commit.
16
17 Once you have fixed a problem, use "bzr resolve" to automatically mark
18- text conflicts as fixed, "bzr resolve FILE" to mark a specific conflict as
19- resolved, or "bzr resolve --all" to mark all conflicts as resolved.
20+ text conflicts as fixed, "bzr resolve --done FILE" to mark a specific
21+ conflict as resolved.
22 """
23 aliases = ['resolved']
24 takes_args = ['file*']
25@@ -137,10 +138,7 @@
26 tree, file_list = workingtree.WorkingTree.open_containing_paths(
27 file_list, directory)
28 if action is None:
29- if file_list is None:
30- action = 'auto'
31- else:
32- action = 'done'
33+ action = 'auto'
34 before, after = resolve(tree, file_list, action=action)
35 # GZ 2012-07-27: Should unify UI below now that auto is less magical.
36 if action == 'auto' and file_list is None:
37
38=== modified file 'bzrlib/help_topics/en/conflict-types.txt'
39--- bzrlib/help_topics/en/conflict-types.txt 2011-04-01 06:58:37 +0000
40+++ bzrlib/help_topics/en/conflict-types.txt 2012-07-27 12:34:38 +0000
41@@ -50,10 +50,11 @@
42
43 ``bzr resolve FILE --action=done'
44
45-Note that this is the default action when a single file is involved so you can
46-simply use::
47+Note that for some kinds of conflict, Bazaar can automatically detect that
48+they have been resolved. You will also be told about any remaining conflicts
49+that still need resolving. Simply use::
50
51- ``bzr resolve FILE``
52+ ``bzr resolve``
53
54 See ``bzr help resolve`` for more details.
55
56
57=== modified file 'bzrlib/tests/test_conflicts.py'
58--- bzrlib/tests/test_conflicts.py 2012-02-23 23:41:51 +0000
59+++ bzrlib/tests/test_conflicts.py 2012-07-27 12:34:38 +0000
60@@ -755,16 +755,18 @@
61 """
62
63 def test_take_this(self):
64+ # GZ 2012-07-27: Using auto should learn how to resolve this?
65 self.run_script("""
66 $ bzr rm -q dir --force
67-$ bzr resolve dir
68+$ bzr resolve --done dir
69 2>2 conflicts resolved, 0 remaining
70 $ bzr commit -q --strict -m 'No more conflicts nor unknown files'
71 """)
72
73 def test_take_other(self):
74+ # GZ 2012-07-27: What's this testing? Should remain conflicted?
75 self.run_script("""
76-$ bzr resolve dir
77+$ bzr resolve --done dir
78 2>2 conflicts resolved, 0 remaining
79 $ bzr commit -q --strict -m 'No more conflicts nor unknown files'
80 """)
81@@ -797,25 +799,28 @@
82 """
83
84 def test_keep_them_all(self):
85+ # GZ 2012-07-27: What's this testing? Should remain conflicted?
86 self.run_script("""
87-$ bzr resolve dir
88+$ bzr resolve --done dir
89 2>2 conflicts resolved, 0 remaining
90 $ bzr commit -q --strict -m 'No more conflicts nor unknown files'
91 """)
92
93 def test_adopt_child(self):
94+ # GZ 2012-07-27: Using auto should learn how to resolve this?
95 self.run_script("""
96 $ bzr mv -q dir/file2 file2
97 $ bzr rm -q dir --force
98-$ bzr resolve dir
99+$ bzr resolve --done dir
100 2>2 conflicts resolved, 0 remaining
101 $ bzr commit -q --strict -m 'No more conflicts nor unknown files'
102 """)
103
104 def test_kill_them_all(self):
105+ # GZ 2012-07-27: Using auto should learn how to resolve this?
106 self.run_script("""
107 $ bzr rm -q dir --force
108-$ bzr resolve dir
109+$ bzr resolve --done dir
110 2>2 conflicts resolved, 0 remaining
111 $ bzr commit -q --strict -m 'No more conflicts nor unknown files'
112 """)
113@@ -861,25 +866,28 @@
114 """
115
116 def test_keep_them_all(self):
117+ # GZ 2012-07-27: What's this testing? Should remain conflicted?
118 self.run_script("""
119-$ bzr resolve dir
120+$ bzr resolve --done dir
121 2>2 conflicts resolved, 0 remaining
122 $ bzr commit -q --strict -m 'No more conflicts nor unknown files'
123 """)
124
125 def test_adopt_child(self):
126+ # GZ 2012-07-27: Using auto should learn how to resolve this?
127 self.run_script("""
128 $ bzr mv -q dir/file2 file2
129 $ bzr rm -q dir --force
130-$ bzr resolve dir
131+$ bzr resolve --done dir
132 2>2 conflicts resolved, 0 remaining
133 $ bzr commit -q --strict -m 'No more conflicts nor unknown files'
134 """)
135
136 def test_kill_them_all(self):
137+ # GZ 2012-07-27: Using auto should learn how to resolve this?
138 self.run_script("""
139 $ bzr rm -q dir --force
140-$ bzr resolve dir
141+$ bzr resolve --done dir
142 2>2 conflicts resolved, 0 remaining
143 $ bzr commit -q --strict -m 'No more conflicts nor unknown files'
144 """)
145@@ -1020,21 +1028,23 @@
146 """
147
148 def test_take_this(self):
149+ # GZ 2012-07-27: What's this testing? Should auto understand it?
150 self.run_script("""
151 $ bzr rm -q foo.new --force
152-# FIXME: Isn't it weird that foo is now unkown even if foo.new has been put
153+# FIXME: Isn't it weird that foo is now unknown even if foo.new has been put
154 # aside ? -- vila 090916
155 $ bzr add -q foo
156-$ bzr resolve foo.new
157+$ bzr resolve --done foo.new
158 2>1 conflict resolved, 0 remaining
159 $ bzr commit -q --strict -m 'No more conflicts nor unknown files'
160 """)
161
162 def test_take_other(self):
163+ # GZ 2012-07-27: Using auto should learn how to resolve this?
164 self.run_script("""
165 $ bzr rm -q foo --force
166 $ bzr mv -q foo.new foo
167-$ bzr resolve foo
168+$ bzr resolve --done foo
169 2>1 conflict resolved, 0 remaining
170 $ bzr commit -q --strict -m 'No more conflicts nor unknown files'
171 """)