I've FW'd your mail to QBzr mailing list / discussion group. I think
it'll be better to keep conversation there. I'm not sure what do you
mean "its seems not active in for few years now (on qbzr part)".
--
All the dude wanted was his rug back
I think the right way and the easisest way to accomplish what you want
is: add new entry to context menu and provide corresponding method.
You should look at qbzr/lib/conflicts.py source, method
create_context_menu is dedicated to build context menu. You may use
"Mark as resolved" entry as example:
self.context_menu.addAction(gettext("Mark as &resolved"),
self.mark_item_as_resolved)
The real work happens in mark_item_as_resolved method, which uses
bzrlib method to resolve conflicts. I think it should be possible to
do similar thing with new --take-this / --take-other support in bzr
itself.
I'd recommend you add 2 new entries to context menu:
Use "this" version
Use "other" version
or something like that and implement both variants. I think if you'll
figure out how to implement "use other" it should be pretty
straightforward to implement and complement variant.
Yeah, look at bzrlib/conflicts.py. You should be able to use very
similar code to mark_item_as_resolved for new context menu entries,
changing resolve call to:
resolve(self.wt, file_names, action='take_this')
and
resolve(self.wt, file_names, action='take_other')
Well, I think the best way is to refactor the common code to helper
method like this:
def _resolve_action(self, action):
items = self.conflicts_list.selectedItems()
file_names = []
for item in items:
# XXX why we need to use file_id -> path conversion if we
already have filename???
# this conversion fails in the case when user removed file
or directory
# which marked as conflicted (e.g. in missing parent
conflict case).
#~file_id = str(item.data(0, QtCore.Qt.UserRole).toString())
#~file_names.append(self.wt.id2path(file_id))
file_names.append(unicode(item.text(0)))
resolve(self.wt, file_names, action=action)
self.refresh()
And then call it from all menu entries callbacks as
def mark_item_as_resolved(self):
self._resolve_action("done")
def take_this(self):
self._resolve_action("take_this")
def take_other(self):
self._resolve_action("take_other")
I think that would do the job. I'll be happy to accept your patch soon :-)
It matches bzr CLI: one can run `bzr resolve` without arguments and bzr
will try to do its best to find the files with properly resolved
conflicts without need to explicitly specify them. I found it very handy.
>
> best regards ,
> Gil Idelson
> RT/Embedded SW Engineer
Excuse me for being curious: what does it mean "RT" in your title?
Alexander Belchenko пишет: