Merge lp:~abudden/bzr-explorer/bound-branch-submit-pane into lp:bzr-explorer

Proposed by Dr Al
Status: Merged
Approved by: Alexander Belchenko
Approved revision: 506
Merged at revision: 512
Proposed branch: lp:~abudden/bzr-explorer/bound-branch-submit-pane
Merge into: lp:bzr-explorer
Diff against target: 191 lines (+70/-24)
5 files modified
NEWS (+4/-0)
lib/status_data.py (+12/-0)
lib/status_report.py (+28/-13)
lib/view_submit.py (+4/-1)
lib/view_workingtree.py (+22/-10)
To merge this branch: bzr merge lp:~abudden/bzr-explorer/bound-branch-submit-pane
Reviewer Review Type Date Requested Status
Alexander Belchenko Approve
Review via email: mp+59959@code.launchpad.net

Description of the change

Possibly slightly controversial, but this works round Bug 777108 by using the parent location in the submit pane for bound branches. If and when lp:~abudden/bzr/switch_parent_513709 (related to Bug 513709) lands and the parent branch is set correctly, this should make the feature branch model with bound branches much more usable.

To post a comment you must log in.
503. By Dr Al

Added better support for feature branch differences: when using bound branches, show parent location rather than submit location.

504. By Dr Al

Updated NEWS.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Should bzr-explorer check for some specific bzr version then to ensure that your fix was landed?

Revision history for this message
Dr Al (abudden) wrote :

On Wednesday, 4 May 2011, Alexander Belchenko <email address hidden> wrote:
> Should bzr-explorer check for some specific bzr version then to ensure that your fix was landed?

I think that would probably be sensible (it can easily be integrated).
I'll add that when (and if) the fix lands. I just thought it would be
good to get the review started early.

Al

> --
> https://code.launchpad.net/~abudden/bzr-explorer/bound-branch-submit-pane/+merge/59959
> You are the owner of lp:~abudden/bzr-explorer/bound-branch-submit-pane.
>

--
http://sites.google.com/site/abudden

Revision history for this message
Dr Al (abudden) wrote :

The bug fix for Bug 513709 has been approved for inclusion in 2.4b3.

A bit more investigation on the Bazaar version: I don't think it is too critical after all. The fix for Bug 513709 sets the correct parent location for both the new master (parent) branch and for the working (bound) branch. Bazaar Explorer looks at the working (bound) branch when identifying the master (parent) branch. Before the patch was landed, the parent location for the master branch was set incorrectly (which is mostly irrelevant to Bazaar Explorer) and the parent location for the working (bound) branch wasn't set at all. Therefore, in branches created before 2.4b3, the submit pane won't be shown and no difference will be seen (there's nothing we can do about this sadly). With this patch, in branches created after 2.4b3, the submit pane will be shown and the correct parent will be visible. Therefore, I don't think we need to check the Bazaar version.

I hope all that makes sense!

Revision history for this message
Alexander Belchenko (bialix) wrote :

Y trust your decision here. Make sure you have tested the bzr-explorer behavior with and without your patch and let's land this.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Alexander Belchenko пишет:
> Y trust your decision here. Make sure you have tested the bzr-explorer behavior with and without your patch and let's land this.
s/Y/I/

--
All the dude wanted was his rug back

Revision history for this message
Alexander Belchenko (bialix) wrote :

Al, I don't like that submit pane and don't use it. One day I want to add config option to hide it forever.

But if it important for you -- then please, test t as you think appropriate, with bound branches and plain branches, and if you're happy with result, then please land it.

Revision history for this message
Alexander Belchenko (bialix) :
review: Abstain
Revision history for this message
Alexander Belchenko (bialix) wrote :

I don't understand some parts of your patch. Don't land it, please, I'd like to ask something.

review: Needs Information
Revision history for this message
Dr Al (abudden) wrote :

No problem, I haven't had a chance to do extensive testing, so I wasn't going to just yet anyway!

Revision history for this message
Dr Al (abudden) wrote :

Okay, I've done quite a bit of testing now and haven't found any problems. What did you want to ask?

Revision history for this message
Alexander Belchenko (bialix) wrote :

OK, I think we can do a better job now and provide better label for the case when there is no submit_branch set. Right now for non-bound branches we have:

submit_url = branch.get_submit_branch() or branch.get_parent()

but the target is always target = 'submit'

Maybe we can provide correct label here as of

submit_url = branch.get_submit_branch()
if submit_url:
  target = 'submit'
  name = gettext('Submit delta')
else:
  submit_url = branch.get_parent()
  target = 'parent'
  name = gettext('Parent delta')

Revision history for this message
Dr Al (abudden) wrote :

On 12 May 2011 16:06, Alexander Belchenko <email address hidden> wrote:
> OK, I think we can do a better job now and provide better label for the case when there is no submit_branch set. Right now for non-bound branches we have:
>
> submit_url = branch.get_submit_branch() or branch.get_parent()
>
> but the target is always target = 'submit'
>
> Maybe we can provide correct label here as of
>
> submit_url = branch.get_submit_branch()
> if submit_url:
>  target = 'submit'
>  name = gettext('Submit delta')
> else:
>  submit_url = branch.get_parent()
>  target = 'parent'
>  name = gettext('Parent delta')

Sounds reasonable: I'll make that change.

Al

505. By Dr Al

Merge trunk

506. By Dr Al

Report correct target name if using parent branch.

Revision history for this message
Dr Al (abudden) wrote :

Done.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Thank you, I'll merge.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2011-05-09 20:53:45 +0000
+++ NEWS 2011-05-13 07:21:10 +0000
@@ -38,6 +38,10 @@
3838
39* Bulgarian translation added.39* Bulgarian translation added.
4040
41Bug Fixes:
42
43* Use the parent branch in the submit pane when working with bound branches.
44 (A. S. Budden, Bug #777108)
4145
421.1.2 26-Nov-2010461.1.2 26-Nov-2010
43-----------------47-----------------
4448
=== modified file 'lib/status_data.py'
--- lib/status_data.py 2011-05-08 18:49:29 +0000
+++ lib/status_data.py 2011-05-13 07:21:10 +0000
@@ -25,6 +25,8 @@
2525
26from bzrlib import errors, revisionspec, status26from bzrlib import errors, revisionspec, status
2727
28from bzrlib import branch as mod_branch
29
2830
29def get_status_info(wt, specific_files=None, versioned=False):31def get_status_info(wt, specific_files=None, versioned=False):
30 """Get the status information for a working tree.32 """Get the status information for a working tree.
@@ -101,3 +103,13 @@
101 rev_spec = revisionspec.RevisionSpec.from_string('submit:')103 rev_spec = revisionspec.RevisionSpec.from_string('submit:')
102 old_tree = rev_spec.as_tree(branch)104 old_tree = rev_spec.as_tree(branch)
103 return changes_between_trees(new_tree, old_tree)[0]105 return changes_between_trees(new_tree, old_tree)[0]
106
107def get_parent_submission_info(branch):
108 """Get the status information for a branch versus its submit branch.
109
110 :return: delta
111 """
112 new_tree = branch.basis_tree()
113 old_branch = mod_branch.Branch.open_containing(branch.get_parent())[0]
114 old_tree = old_branch.basis_tree()
115 return changes_between_trees(new_tree, old_tree)[0]
104116
=== modified file 'lib/status_report.py'
--- lib/status_report.py 2011-05-08 18:49:29 +0000
+++ lib/status_report.py 2011-05-13 07:21:10 +0000
@@ -271,10 +271,6 @@
271class SubmitReport(_BaseStatusReport):271class SubmitReport(_BaseStatusReport):
272272
273 # Formatters by section273 # Formatters by section
274 def _added_formatter(items):
275 # Diff is useful here because it shows what's committed which, unlike
276 # the plain status case, may vary from the current file contents
277 return _edit_with_actions_decorator(items[0], ['diff(-rsubmit:..-1)'])
278 def _deleted_formatter(items):274 def _deleted_formatter(items):
279 return items[0]275 return items[0]
280 def _renamed_formatter(items):276 def _renamed_formatter(items):
@@ -283,25 +279,44 @@
283 def _kind_changed_formatter(items):279 def _kind_changed_formatter(items):
284 text = "%s (%s => %s)" % (items[0], items[2], items[3])280 text = "%s (%s => %s)" % (items[0], items[2], items[3])
285 return _edit_decorator(items[0], text)281 return _edit_decorator(items[0], text)
286 def _modified_formatter(items):282
287 return _edit_with_actions_decorator(items[0], ['diff(-rsubmit:..-1)'])283 # Create formatters on the fly where diff is used as
284 # the ancestor branch varies
285 def _make_diff_based_formatter(self):
286 if self.target == 'parent':
287 parent_branch = self.branch.get_parent()
288 diff_path = 'diff(-rancestor:%s..-1)' % parent_branch
289 else:
290 diff_path = 'diff(-rsubmit:..-1)'
291 def _diff_based_formatter(items):
292 return _edit_with_actions_decorator(items[0], [diff_path])
293 return _diff_based_formatter
294
288 formatter_map = {295 formatter_map = {
289 'Added': _added_formatter,296 'Added': None, # Added in _collect_data
290 'Deleted': _deleted_formatter,297 'Deleted': _deleted_formatter,
291 'Renamed': _renamed_formatter,298 'Renamed': _renamed_formatter,
292 'Kind changed': _kind_changed_formatter,299 'Kind changed': _kind_changed_formatter,
293 'Modified': _modified_formatter,300 'Modified': None, # Added in _collect_data
294 }301 }
295302
296 def __init__(self, branch):303 def __init__(self, branch, target='submit'):
297 self.branch = branch304 self.branch = branch
305 self.target = target
298 self._collect_data()306 self._collect_data()
299307
300 def _collect_data(self):308 def _collect_data(self):
301 self._data = None309 self._data = None
302 self._exception = None310 self._exception = None
303 try:311 try:
304 delta = status_data.get_submission_info(self.branch)312 if self.target == 'submit':
313 delta = status_data.get_submission_info(self.branch)
314 elif self.target == 'parent':
315 delta = status_data.get_parent_submission_info(self.branch)
316 else:
317 raise errors.BzrError("Unrecognised target type")
318 self.formatter_map['Added'] = self._make_diff_based_formatter()
319 self.formatter_map['Modified'] = self._make_diff_based_formatter()
305 if delta.has_changed():320 if delta.has_changed():
306 self._data = delta321 self._data = delta
307 except errors.BzrError, ex:322 except errors.BzrError, ex:
@@ -312,10 +327,10 @@
312 return html_status_message(ERROR_STATUS, unicode(self._exception))327 return html_status_message(ERROR_STATUS, unicode(self._exception))
313 elif self._data:328 elif self._data:
314 indicator = WARNING_STATUS329 indicator = WARNING_STATUS
315 msg = gettext("Branch has changes not present in its submit branch.")330 msg = gettext("Branch has changes not present in its %s branch." % self.target)
316 else:331 else:
317 indicator = GOOD_STATUS332 indicator = GOOD_STATUS
318 msg = gettext("Branch is fully merged into its submit branch.")333 msg = gettext("Branch is fully merged into its %s branch." % self.target)
319 return html_status_message(indicator, msg)334 return html_status_message(indicator, msg)
320335
321 def body_lines(self):336 def body_lines(self):
@@ -337,6 +352,6 @@
337 delta = self._data352 delta = self._data
338 if delta.has_changed():353 if delta.has_changed():
339 open_parent_msg = gettext(354 open_parent_msg = gettext(
340 "Open parent branch and merge these changes")355 "Open %s branch and merge these changes" % self.target)
341 lines.append(_text_decorator(open_parent_msg))356 lines.append(_text_decorator(open_parent_msg))
342 return lines357 return lines
343358
=== modified file 'lib/view_submit.py'
--- lib/view_submit.py 2011-05-08 18:49:29 +0000
+++ lib/view_submit.py 2011-05-13 07:21:10 +0000
@@ -28,7 +28,10 @@
28 shown using -rsubmit:..-1, i.e. what's been committed so far28 shown using -rsubmit:..-1, i.e. what's been committed so far
29 versus the submit branch.29 versus the submit branch.
30 """30 """
31 def __init__(self, model, action_callback, target):
32 super(SubmitView, self).__init__(model, action_callback)
33 self.target = target
3134
32 def report_text(self):35 def report_text(self):
33 report = status_report.SubmitReport(self._model.branch)36 report = status_report.SubmitReport(self._model.branch, self.target)
34 return report.full_report()37 return report.full_report()
3538
=== modified file 'lib/view_workingtree.py'
--- lib/view_workingtree.py 2009-12-09 23:43:32 +0000
+++ lib/view_workingtree.py 2011-05-13 07:21:10 +0000
@@ -39,20 +39,32 @@
39 # value ones which everyone ought to want. :-)39 # value ones which everyone ought to want. :-)
40 self.detail_views = []40 self.detail_views = []
41 branch = self.model.branch41 branch = self.model.branch
42 # Display the delta versus the submit branch iff one is42 # Display the delta versus the submit or parent branch iff one is
43 # defined and it's local. Unfortunately though, merging a feature43 # defined and it's local. Unfortunately though, merging a feature
44 # branch into trunk sets the merged-from branch as the submit44 # branch into trunk sets the merged-from branch as the submit
45 # branch which means we see a "silly" submit delta panel for trunk.45 # branch which means we see a "silly" submit delta panel for trunk.
46 # To work around that, we don't show the panel for bound branches46 # To work around that, we show the parent location instead of the
47 # as trunk ought to be bound. We could look for the name47 # submit location for a bound branch.
48 # "trunk" instead but that sounds even more of a hack. :-(
49 if branch.get_bound_location() is None:48 if branch.get_bound_location() is None:
50 submit_url = branch.get_submit_branch() or branch.get_parent()49 submit_url = branch.get_submit_branch()
51 if submit_url and submit_url.startswith("file:"):50 if submit_url:
52 self.detail_views.append(51 target = 'submit'
53 (view_submit.SubmitView(model, action_callback,),52 name = gettext('Submit delta')
54 gettext("Submit delta")),53 else:
55 )54 submit_url = branch.get_parent()
55 target = 'parent'
56 name = gettext('Parent delta')
57 else:
58 target = 'parent'
59 name = gettext('Parent delta')
60 submit_url = branch.get_parent()
61
62 if submit_url and submit_url.startswith("file:"):
63 self.detail_views.append(
64 (view_submit.SubmitView(model, action_callback, target),
65 name),
66 )
67
56 # TODO: add other panels to show what's on the shelf, etc.68 # TODO: add other panels to show what's on the shelf, etc.
5769
58 def ui(self):70 def ui(self):

Subscribers

People subscribed via source and target branches