threads / discuss / 26490

[STGIT] AssertionError on stg rebase

Subject: [STGIT] AssertionError on stg rebase

## tl;dr

2 messages between Feb 13, 2011 and Feb 14, 2011.

replies: 1people: 2as markdown or json

Henrique de Moraes Holschuh· Feb 13, 2011, 19:35 UTC · lore
(please keep me CC'd, I am currently not subscribed to the git ML)

It appears stgit dislikes something on the v2.6.27 longterm tree, or something else is hosed on my system. It is causing me a lot of trouble, I now have a few backport branches that are unusable, and that I'd like very much to fix...

Tested with stgit 0.15, and also stgit "proposed" branch. Debian squeeze, both in ia32 and x86-64.

Here is a testcase to reproduce the problem:

$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/longterm/linux-2.6.27.y.git $ cd linux-2.6.27.y $ git reset --hard v2.6.27.53 $ stg init $ stg new test-patch-1 $ echo "something" > changedfile $ git add changedfile $ stg refresh

$ stg rebase v2.6.27.58
Checking for changes in the working directory ... done
Popping all applied patches ... done
Rebasing to "v2.6.27.58" ... done
Pushing patch "test-patch-1" ... done
Now at patch "test-patch-1"
Traceback (most recent call last):
  File "/usr/bin/stg", line 44, in <module>
    main()
  File "/usr/lib/pymodules/python2.6/stgit/main.py", line 175, in main
    _main()
  File "/usr/lib/pymodules/python2.6/stgit/main.py", line 170, in _main
    directory.write_log(cmd)
  File "/usr/lib/pymodules/python2.6/stgit/commands/common.py", line 537, in write_log
    log.compat_log_entry(msg)
  File "/usr/lib/pymodules/python2.6/stgit/lib/log.py", line 372, in compat_log_entry
    log_entry(stack, msg)
  File "/usr/lib/pymodules/python2.6/stgit/lib/log.py", line 328, in log_entry
    new_log.write_commit()
  File "/usr/lib/pymodules/python2.6/stgit/lib/log.py", line 283, in write_commit
    tree = self.__tree(metadata)
  File "/usr/lib/pymodules/python2.6/stgit/lib/log.py", line 277, in __tree
    patches = dict((pn, pf(c)) for pn, c in self.patches.iteritems())
  File "/usr/lib/pymodules/python2.6/stgit/lib/log.py", line 277, in <genexpr>
    patches = dict((pn, pf(c)) for pn, c in self.patches.iteritems())
  File "/usr/lib/pymodules/python2.6/stgit/lib/log.py", line 275, in pf
    r = patch_file(self.__repo, c.data)
  File "/usr/lib/pymodules/python2.6/stgit/lib/log.py", line 116, in patch_file
    'Bottom: %s' % cd.parent.data.tree.sha1,
  File "/usr/lib/pymodules/python2.6/stgit/lib/git.py", line 426, in data
    self.__repository.cat_object(self.sha1))
  File "/usr/lib/pymodules/python2.6/stgit/lib/git.py", line 408, in parse
    assert False
AssertionError

I have other failure modes that also result on assertions, but they all look like the same basic problem, and this one is at least easy to reproduce.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
Catalin Marinas· Feb 14, 2011, 17:23 UTC · re: Henrique de Moraes Holschuh · lore

Re: [STGIT] AssertionError on stg rebase

Hi,
On 13 February 2011 19:35, Henrique de Moraes Holschuh <hmh@hmh.eng.br> wrote:
Show 19 quoted lines
> Here is a testcase to reproduce the problem:
>
> $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/longterm/linux-2.6.27.y.git
> $ cd linux-2.6.27.y
> $ git reset --hard v2.6.27.53
> $ stg init
> $ stg new test-patch-1
> $ echo "something" > changedfile
> $ git add changedfile
> $ stg refresh
>
> $ stg rebase v2.6.27.58
>
> Checking for changes in the working directory ... done
> Popping all applied patches ... done
> Rebasing to "v2.6.27.58" ... done
> Pushing patch "test-patch-1" ... done
> Now at patch "test-patch-1"
> Traceback (most recent call last):
[...]
>  File "/usr/lib/pymodules/python2.6/stgit/lib/git.py", line 408, in parse
>    assert False
> AssertionError

StGit is parsing the commit information for some key/value pairs. It looks like it found one which it didn't know about - "encoding: latin1" and it failed.

For now it is OK to just remove the assert. The drawback is that if you do some "stg uncommit" on some existing commits, it will lose additional information but I don't think it matters to you since you create your patches with StGit anyway and it doesn't generate such information. Longer term we may want to preserve other things that may appear in the commit data. I'll push this to the StGit repository as well.

diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 3378728..f5ea965 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -404,8 +404,6 @@ class CommitData(Immutable, Repr):
                 cd = cd.set_author(Person.parse(value))
             elif key == 'committer':
                 cd = cd.set_committer(Person.parse(value))
-            else:
-                assert False
         assert False

 class Commit(GitObject):


Thanks.
-- 
Catalin

← back to recent threads