* [sup-talk] [PATCH] Allow multi_edit_labels to remove labels using -lab (the "; l" key binding)
@ 2009-03-16 18:35 Nicolas Pouillard
2009-03-18 15:33 ` Nicolas Pouillard
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Pouillard @ 2009-03-16 18:35 UTC (permalink / raw)
Resent..
---
lib/sup/modes/thread-index-mode.rb | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
index 3dd0498..bde61cf 100644
--- a/lib/sup/modes/thread-index-mode.rb
+++ b/lib/sup/modes/thread-index-mode.rb
@@ -448,13 +448,22 @@ EOS
end
def multi_edit_labels threads
- user_labels = BufferManager.ask_for_labels :add_labels, "Add labels: ", [], @hidden_labels
+ user_labels = BufferManager.ask_for_labels :labels, "Add/remove labels (use -label to remove): ", [], @hidden_labels
return unless user_labels
-
- hl = user_labels.select { |l| @hidden_labels.member? l }
+
+ user_labels.map! { |l| (l.to_s =~ /^-/)? [l.to_s.gsub(/^-?/, '').to_sym, true] : [l, false] }
+ hl = user_labels.select { |(l,_)| @hidden_labels.member? l }
if hl.empty?
- threads.each { |t| user_labels.each { |l| t.apply_label l } }
- user_labels.each { |l| LabelManager << l }
+ threads.each do |t|
+ user_labels.each do |(l, to_remove)|
+ if to_remove
+ t.remove_label l
+ else
+ t.apply_label l
+ end
+ end
+ end
+ user_labels.each { |(l,_)| LabelManager << l }
else
BufferManager.flash "'#{hl}' is a reserved label!"
end
--
Nicolas Pouillard
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] Allow multi_edit_labels to remove labels using -lab (the "; l" key binding)
2009-03-16 18:35 [sup-talk] [PATCH] Allow multi_edit_labels to remove labels using -lab (the "; l" key binding) Nicolas Pouillard
@ 2009-03-18 15:33 ` Nicolas Pouillard
2009-03-22 21:21 ` William Morgan
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Pouillard @ 2009-03-18 15:33 UTC (permalink / raw)
This patch conflict with the undo feature, I've locally resolved the merge.
However I don't really know what the best way to share the conflict
resolution.
Excerpts from Nicolas Pouillard's message of Mon Mar 16 19:35:43 +0100 2009:
> Resent..
>
> ---
> lib/sup/modes/thread-index-mode.rb | 19 ++++++++++++++-----
> 1 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
> index 3dd0498..bde61cf 100644
> --- a/lib/sup/modes/thread-index-mode.rb
> +++ b/lib/sup/modes/thread-index-mode.rb
> @@ -448,13 +448,22 @@ EOS
> end
>
> def multi_edit_labels threads
> - user_labels = BufferManager.ask_for_labels :add_labels, "Add labels: ", [], @hidden_labels
> + user_labels = BufferManager.ask_for_labels :labels, "Add/remove labels (use -label to remove): ", [], @hidden_labels
> return unless user_labels
> -
> - hl = user_labels.select { |l| @hidden_labels.member? l }
> +
> + user_labels.map! { |l| (l.to_s =~ /^-/)? [l.to_s.gsub(/^-?/, '').to_sym, true] : [l, false] }
> + hl = user_labels.select { |(l,_)| @hidden_labels.member? l }
> if hl.empty?
> - threads.each { |t| user_labels.each { |l| t.apply_label l } }
> - user_labels.each { |l| LabelManager << l }
> + threads.each do |t|
> + user_labels.each do |(l, to_remove)|
> + if to_remove
> + t.remove_label l
> + else
> + t.apply_label l
> + end
> + end
> + end
> + user_labels.each { |(l,_)| LabelManager << l }
> else
> BufferManager.flash "'#{hl}' is a reserved label!"
> end
>
--
Nicolas Pouillard
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] Allow multi_edit_labels to remove labels using -lab (the "; l" key binding)
2009-03-18 15:33 ` Nicolas Pouillard
@ 2009-03-22 21:21 ` William Morgan
2009-03-23 10:26 ` Nicolas Pouillard
0 siblings, 1 reply; 6+ messages in thread
From: William Morgan @ 2009-03-22 21:21 UTC (permalink / raw)
Reformatted excerpts from nicolas.pouillard's message of 2009-03-18:
> This patch conflict with the undo feature, I've locally resolved the
> merge. However I don't really know what the best way to share the
> conflict resolution.
That's a good question. For some reason git format-patch doesn't produce
anything for merge commits, even if they contain conflict resolution
changes. Maybe it's for a good reason; I don't know.
But you can use git diff. After merging and resolving the conflict, if
you do "git diff HEAD^", that should output the conflict-resolution
changes. You can send that to me and I can use it to replicate the
commit.
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] Allow multi_edit_labels to remove labels using -lab (the "; l" key binding)
2009-03-22 21:21 ` William Morgan
@ 2009-03-23 10:26 ` Nicolas Pouillard
2009-03-23 14:49 ` William Morgan
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Pouillard @ 2009-03-23 10:26 UTC (permalink / raw)
Excerpts from William Morgan's message of Sun Mar 22 22:21:46 +0100 2009:
> Reformatted excerpts from nicolas.pouillard's message of 2009-03-18:
> > This patch conflict with the undo feature, I've locally resolved the
> > merge. However I don't really know what the best way to share the
> > conflict resolution.
>
> That's a good question. For some reason git format-patch doesn't produce
> anything for merge commits, even if they contain conflict resolution
> changes. Maybe it's for a good reason; I don't know.
>
> But you can use git diff. After merging and resolving the conflict, if
> you do "git diff HEAD^", that should output the conflict-resolution
> changes. You can send that to me and I can use it to replicate the
> commit.
I've applied the resolution in a local branch, a attach to patches.
The first is done with 'git diff' before commit the conflict resolution.
The second is done with 'git diff HEAD^' just after.
--
Nicolas Pouillard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: undo+multi_edit_labels+remove.patch
Type: application/octet-stream
Size: 1901 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090323/aa8a4b3b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: undo+multi_edit_labels+remove2.patch
Type: application/octet-stream
Size: 1861 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090323/aa8a4b3b/attachment-0001.obj>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] Allow multi_edit_labels to remove labels using -lab (the "; l" key binding)
2009-03-23 10:26 ` Nicolas Pouillard
@ 2009-03-23 14:49 ` William Morgan
2009-03-23 15:18 ` Nicolas Pouillard
0 siblings, 1 reply; 6+ messages in thread
From: William Morgan @ 2009-03-23 14:49 UTC (permalink / raw)
Reformatted excerpts from nicolas.pouillard's message of 2009-03-23:
> I've applied the resolution in a local branch, a attach to patches.
> The first is done with 'git diff' before commit the conflict resolution.
> The second is done with 'git diff HEAD^' just after.
Only the second patch was really necessary. But thanks, it worked!
I've applied this patch on a branch called multi-remove-labels and it's
been merged into next.
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] Allow multi_edit_labels to remove labels using -lab (the "; l" key binding)
2009-03-23 14:49 ` William Morgan
@ 2009-03-23 15:18 ` Nicolas Pouillard
0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Pouillard @ 2009-03-23 15:18 UTC (permalink / raw)
Excerpts from William Morgan's message of Mon Mar 23 15:49:13 +0100 2009:
> Reformatted excerpts from nicolas.pouillard's message of 2009-03-23:
> > I've applied the resolution in a local branch, a attach to patches.
> > The first is done with 'git diff' before commit the conflict resolution.
> > The second is done with 'git diff HEAD^' just after.
>
> Only the second patch was really necessary. But thanks, it worked!
>
> I've applied this patch on a branch called multi-remove-labels and it's
> been merged into next.
Great
--
Nicolas Pouillard
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-03-23 15:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-16 18:35 [sup-talk] [PATCH] Allow multi_edit_labels to remove labels using -lab (the "; l" key binding) Nicolas Pouillard
2009-03-18 15:33 ` Nicolas Pouillard
2009-03-22 21:21 ` William Morgan
2009-03-23 10:26 ` Nicolas Pouillard
2009-03-23 14:49 ` William Morgan
2009-03-23 15:18 ` Nicolas Pouillard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox