threads / discuss / 15661

stg 0.14.3 breakage on push after moving hunk

Subject: stg 0.14.3 breakage on push after moving hunk

## tl;dr

5 messages between Sep 24, 2008 and Sep 25, 2008.

replies: 4people: 2as markdown or json

Yann Dirson· Sep 24, 2008, 23:26 UTC · lore
Just saw the following problem - ever saw that ?

Getting into context: split changes affecting a particular file into another patch

$ stg --version Stacked GIT 0.14.3 git version 1.6.0.1 Python version 2.5.2 (r252:60911, Aug 8 2008, 09:22:44) [GCC 4.3.1]

$ stg pop Checking for changes in the working directory ... done Popping patch "factorize" ... done Now at patch "x-dummy" $ stg new -m test $ stg-fold-files-from factorize 't/*' Checking for changes in the working directory ... done Folding patch from stdin ... done $ stg ref Checking for changes in the working directory ... done Refreshing patch "test" ... done

... then attempting to push to get rid of the now-duplicated changes from orig patch (which has been how I have used stg-fold-files-from ever since I wrote it, so I'm pretty sure it used to work, but then, it's been a couple of months since I did not use it ;):

$ stg push
Checking for changes in the working directory ... done
Pushing patch "factorize" ... Traceback (most recent call last):
  File "/usr/bin/stg", line 43, in <module>
    main()
  File "/var/lib/python-support/python2.5/stgit/main.py", line 281, in main
    command.func(parser, options, args)   
  File "/var/lib/python-support/python2.5/stgit/commands/push.py", line 102, in func
    push_patches(crt_series, patches, options.merged)
  File "/var/lib/python-support/python2.5/stgit/commands/common.py", line 202, in push_patches
    modified = crt_series.push_patch(p)
  File "/var/lib/python-support/python2.5/stgit/stack.py", line 1112, in push_patch
    git.merge(bottom, head, top, recursive = True)
  File "/var/lib/python-support/python2.5/stgit/git.py", line 790, in merge
    stages['2'][0], stages['3'][0]) != 0:
  File "/var/lib/python-support/python2.5/stgit/gitmergeonefile.py", line 268, in merge
    % path)
TypeError: not all arguments converted during string formatting
Best regards,
-- 
Yann
Karl Hasselström· Sep 25, 2008, 07:23 UTC · re: Yann Dirson · lore

Re: stg 0.14.3 breakage on push after moving hunk

On 2008-09-25 01:26:54 +0200, Yann Dirson wrote:
Show 20 quoted lines
> Just saw the following problem - ever saw that ?
>
> $ stg push
> Checking for changes in the working directory ... done
> Pushing patch "factorize" ... Traceback (most recent call last):
>   File "/usr/bin/stg", line 43, in <module>
>     main()
>   File "/var/lib/python-support/python2.5/stgit/main.py", line 281, in main
>     command.func(parser, options, args)   
>   File "/var/lib/python-support/python2.5/stgit/commands/push.py", line 102, in func
>     push_patches(crt_series, patches, options.merged)
>   File "/var/lib/python-support/python2.5/stgit/commands/common.py", line 202, in push_patches
>     modified = crt_series.push_patch(p)
>   File "/var/lib/python-support/python2.5/stgit/stack.py", line 1112, in push_patch
>     git.merge(bottom, head, top, recursive = True)
>   File "/var/lib/python-support/python2.5/stgit/git.py", line 790, in merge
>     stages['2'][0], stages['3'][0]) != 0:
>   File "/var/lib/python-support/python2.5/stgit/gitmergeonefile.py", line 268, in merge
>     % path)
> TypeError: not all arguments converted during string formatting
No, but try this ...
diff --git a/stgit/gitmergeonefile.py b/stgit/gitmergeonefile.py
index c1af2f8..55b62db 100644
--- a/stgit/gitmergeonefile.py
+++ b/stgit/gitmergeonefile.py
@@ -264,7 +264,7 @@ def merge(orig_hash, file1_hash, file2_hash,
                     __conflict(path)
                     return 1
                 if file1_mode != file2_mode:
-                    out.error('File "s" added in both, permissions conflict'
+                    out.error('File "%s" added in both, permissions conflict'
                               % path)
                     __conflict(path)
                     return 1
-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Yann Dirson· Sep 25, 2008, 07:57 UTC · re: Karl Hasselström · lore

Re: stg 0.14.3 breakage on push after moving hunk

On Thu, Sep 25, 2008 at 09:23:22AM +0200, Karl Hasselström wrote:
> > TypeError: not all arguments converted during string formatting
> 
> No, but try this ...

Thanks, it does fix the exception - I feel a bit ashamed of not having looked at the code myself ;)

Nevertheless, that error was only hiding another more annoying problem:
$ ../stgit/stg push
Checking for changes in the working directory ... done
Pushing patch "factorize" ...
  Error: File "t/t4030-diff-rename-factorize.sh" added in both, permissions conflict
  Error: The merge failed during "push".  
         Use "refresh" after fixing the conflicts or revert the operation with "push --undo".
  stg push: GIT index merging failed (possible conflicts)
$ md5sum t/t4030-diff-rename-factorize.sh*
cc313acd2824036556128b3e0879dd07  t/t4030-diff-rename-factorize.sh
cc313acd2824036556128b3e0879dd07  t/t4030-diff-rename-factorize.sh.current
cc313acd2824036556128b3e0879dd07  t/t4030-diff-rename-factorize.sh.patched

AFAICT, adding the same file in 2 branches used not to produce a conflict at all. Is that intended ?

Best regards,
-- 
Yann
Karl Hasselström· Sep 25, 2008, 08:37 UTC · re: Yann Dirson · lore

Re: stg 0.14.3 breakage on push after moving hunk

On 2008-09-25 09:57:32 +0200, Yann Dirson wrote:
> Thanks, it does fix the exception - I feel a bit ashamed of not
> having looked at the code myself ;)
:-)
Show 17 quoted lines
> Nevertheless, that error was only hiding another more annoying
> problem:
>
> $ ../stgit/stg push
> Checking for changes in the working directory ... done
> Pushing patch "factorize" ...
>   Error: File "t/t4030-diff-rename-factorize.sh" added in both, permissions conflict
>   Error: The merge failed during "push".  
>          Use "refresh" after fixing the conflicts or revert the operation with "push --undo".
>   stg push: GIT index merging failed (possible conflicts)
> $ md5sum t/t4030-diff-rename-factorize.sh*
> cc313acd2824036556128b3e0879dd07  t/t4030-diff-rename-factorize.sh
> cc313acd2824036556128b3e0879dd07  t/t4030-diff-rename-factorize.sh.current
> cc313acd2824036556128b3e0879dd07  t/t4030-diff-rename-factorize.sh.patched
>
> AFAICT, adding the same file in 2 branches used not to produce a
> conflict at all. Is that intended ?

"permissions conflict" sounds like it was added with the exec bit in one branch, and without in the other. Is that right? And

  1. Does it work if there's no permissions conflict?
  2. Did it work before if there was a permissions conflict?

Just a guess, but it's entirely plausible that this case never worked, and you're the first to hit it.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Yann Dirson· Sep 25, 2008, 18:54 UTC · re: Karl Hasselström · lore

Re: stg 0.14.3 breakage on push after moving hunk

On Thu, Sep 25, 2008 at 10:37:47AM +0200, Karl Hasselström wrote:
Show 28 quoted lines
> On 2008-09-25 09:57:32 +0200, Yann Dirson wrote:
> 
> > Thanks, it does fix the exception - I feel a bit ashamed of not
> > having looked at the code myself ;)
> 
> :-)
> 
> > Nevertheless, that error was only hiding another more annoying
> > problem:
> >
> > $ ../stgit/stg push
> > Checking for changes in the working directory ... done
> > Pushing patch "factorize" ...
> >   Error: File "t/t4030-diff-rename-factorize.sh" added in both, permissions conflict
> >   Error: The merge failed during "push".  
> >          Use "refresh" after fixing the conflicts or revert the operation with "push --undo".
> >   stg push: GIT index merging failed (possible conflicts)
> > $ md5sum t/t4030-diff-rename-factorize.sh*
> > cc313acd2824036556128b3e0879dd07  t/t4030-diff-rename-factorize.sh
> > cc313acd2824036556128b3e0879dd07  t/t4030-diff-rename-factorize.sh.current
> > cc313acd2824036556128b3e0879dd07  t/t4030-diff-rename-factorize.sh.patched
> >
> > AFAICT, adding the same file in 2 branches used not to produce a
> > conflict at all. Is that intended ?
> 
> "permissions conflict" sounds like it was added with the exec bit in
> one branch, and without in the other. Is that right? And
>   1. Does it work if there's no permissions conflict?

Doh. Sure, it does work, and as expected. Some days really deserve to be spent sleeping :}

>   2. Did it work before if there was a permissions conflict?
> 
> Just a guess, but it's entirely plausible that this case never worked,
> and you're the first to hit it.

I is also entirely plausible that I lacked sleep enough not to read correctly what was printed, and that the behaviour was indeed correct :>

The problem is mostly a limitation of the way stg-fold-files-from works, relying on patchutils which do not know about git extensions to the diff format. And since I mostly used it in the past on a git-cvsimport'ed tree, permissions never bothered me.

Best regards,
-- 
Yann

← back to recent threads