diff mbox

[Resend] pwclient: support 3-way merge

Message ID 2d207ca2-ceb8-ab3f-14cc-1de2e7fd6274@suse.com
State Superseded
Headers show

Commit Message

Matthias Brugger Nov. 18, 2016, 9:44 a.m. UTC
Add support for the 3-way merge in git-am.
This can be done via
   - the commandline
   - the global option section
   - the per-project section

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
---
  patchwork/bin/pwclient | 12 ++++++++++++
  1 file changed, 12 insertions(+)

      config = ConfigParser.ConfigParser()
@@ -657,6 +663,10 @@ def main():
          do_signoff = config.getboolean('options', 'signoff')
      if not do_signoff and config.has_option(project_str, 'signoff'):
          do_signoff = config.getboolean(project_str, 'signoff')
+    if not do_three_way and config.has_option('options', '3way'):
+        do_three_way = config.getboolean('options', '3way')
+    if not do_three_way and config.has_option(project_str, '3way'):
+        do_three_way = config.getboolean(project_str, '3way')

      url = config.get(project_str, 'url')

@@ -764,6 +774,8 @@ def main():
          cmd = ['git', 'am']
          if do_signoff:
              cmd.append('-s')
+        if do_three_way:
+            cmd.append('-3')
          for patch_id in non_empty(h, patch_ids):
              ret = action_apply(rpc, patch_id, cmd)
              if ret:

Comments

Stephen Finucane Dec. 18, 2016, 10:50 p.m. UTC | #1
On Fri, 2016-11-18 at 10:44 +0100, Matthias Brugger wrote:
> Add support for the 3-way merge in git-am.
> This can be done via
>    - the commandline
>    - the global option section
>    - the per-project section
> 
> Signed-off-by: Matthias Brugger <mbrugger@suse.com>

Funnily enough, this failed to apply :) Could you resend this once
more?

Stephen

---

$ curl https://patchwork.ozlabs.org/patch/696524/mbox/ | git am -3
  % Total    % Received % Xferd  Average
Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left 
 Speed
100  2341    0  2341    0     0   1547      0 --:--:--  0:00:01 --:--:-
-  1548
Applying: pwclient: support 3-way merge
fatal: patch fragment without header at line 6: @@ -657,6 +663,10 @@
def main():
error: could not build fake ancestor
Patch failed at 0001 pwclient: support 3-way merge
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Matthias Brugger Dec. 19, 2016, 11:12 a.m. UTC | #2
On 18/11/16 10:44, Matthias Brugger wrote:
> Add support for the 3-way merge in git-am.
> This can be done via
>   - the commandline
>   - the global option section
>   - the per-project section
>
> Signed-off-by: Matthias Brugger <mbrugger@suse.com>

Stephen, any comments/objection on this patch?

Regards,
Matthias

> ---
>  patchwork/bin/pwclient | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/patchwork/bin/pwclient b/patchwork/bin/pwclient
> index ce18e54..0292818 100755
> --- a/patchwork/bin/pwclient
> +++ b/patchwork/bin/pwclient
> @@ -463,6 +463,11 @@ def main():
>          action='store_true',
>          help='''pass --signoff to git-am'''
>      )
> +    git_am_parser.add_argument(
> +        '-3', '--3way',
> +        action='store_true',
> +        help='''pass --3way to git-am'''
> +    )
>      get_parser = subparsers.add_parser(
>          'get', parents=[hash_parser], conflict_handler='resolve',
>          help='''Download a patch and save it locally'''
> @@ -600,6 +605,7 @@ def main():
>              action_parser.error("Invalid maximum count '%s'" %
> args.get('N'))
>
>      do_signoff = args.get('signoff')
> +    do_three_way = args.get('3way')
>
>      # grab settings from config files
>      config = ConfigParser.ConfigParser()
> @@ -657,6 +663,10 @@ def main():
>          do_signoff = config.getboolean('options', 'signoff')
>      if not do_signoff and config.has_option(project_str, 'signoff'):
>          do_signoff = config.getboolean(project_str, 'signoff')
> +    if not do_three_way and config.has_option('options', '3way'):
> +        do_three_way = config.getboolean('options', '3way')
> +    if not do_three_way and config.has_option(project_str, '3way'):
> +        do_three_way = config.getboolean(project_str, '3way')
>
>      url = config.get(project_str, 'url')
>
> @@ -764,6 +774,8 @@ def main():
>          cmd = ['git', 'am']
>          if do_signoff:
>              cmd.append('-s')
> +        if do_three_way:
> +            cmd.append('-3')
>          for patch_id in non_empty(h, patch_ids):
>              ret = action_apply(rpc, patch_id, cmd)
>              if ret:
> _______________________________________________
> Patchwork mailing list
> Patchwork@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork
Stephen Finucane Dec. 19, 2016, 2:33 p.m. UTC | #3
On Mon, 2016-12-19 at 12:12 +0100, Matthias Brugger wrote:
> 
> On 18/11/16 10:44, Matthias Brugger wrote:
> > Add support for the 3-way merge in git-am.
> > This can be done via
> >   - the commandline
> >   - the global option section
> >   - the per-project section
> > 
> > Signed-off-by: Matthias Brugger <mbrugger@suse.com>
> 
> Stephen, any comments/objection on this patch?
> 
> Regards,
> Matthias

None, other that I can't apply it, heh. See mail from last night.

  https://lists.ozlabs.org/pipermail/patchwork/2016-December/003876.htm
l

Can you resend one final time?

Stephen
Stephen Finucane Dec. 19, 2016, 3:17 p.m. UTC | #4
On Mon, 2016-12-19 at 14:33 +0000, Stephen Finucane wrote:
> On Mon, 2016-12-19 at 12:12 +0100, Matthias Brugger wrote:
> > 
> > On 18/11/16 10:44, Matthias Brugger wrote:
> > > Add support for the 3-way merge in git-am.
> > > This can be done via
> > >   - the commandline
> > >   - the global option section
> > >   - the per-project section
> > > 
> > > Signed-off-by: Matthias Brugger <mbrugger@suse.com>
> > 
> > Stephen, any comments/objection on this patch?
> > 
> > Regards,
> > Matthias
> 
> None, other that I can't apply it, heh. See mail from last night.
> 
>   https://lists.ozlabs.org/pipermail/patchwork/2016-December/003876.h
> tm
> l
> 
> Can you resend one final time?

Actually I do have one comment after inspecting it further. I don't
know if we should be wrapping the arguments of git-am. I think a combo
of 'parse_known_args' (instead of 'parse_args') and the '--' marker
could be used to allow us to pass all arguments through to git-am,
allowing for any option (which seems like a good thing):

    $ pwclient git-am 123 -- --3way --utf8 -i

*However*, I'm also happy with this as is so I'll leave the decision to
you.

Stephen
diff mbox

Patch

diff --git a/patchwork/bin/pwclient b/patchwork/bin/pwclient
index ce18e54..0292818 100755
--- a/patchwork/bin/pwclient
+++ b/patchwork/bin/pwclient
@@ -463,6 +463,11 @@  def main():
          action='store_true',
          help='''pass --signoff to git-am'''
      )
+    git_am_parser.add_argument(
+        '-3', '--3way',
+        action='store_true',
+        help='''pass --3way to git-am'''
+    )
      get_parser = subparsers.add_parser(
          'get', parents=[hash_parser], conflict_handler='resolve',
          help='''Download a patch and save it locally'''
@@ -600,6 +605,7 @@  def main():
              action_parser.error("Invalid maximum count '%s'" % 
args.get('N'))

      do_signoff = args.get('signoff')
+    do_three_way = args.get('3way')

      # grab settings from config files