Patchwork hgsubversion + evolve + Mercurial 3.0 = crash

login
register
mail settings
Submitter Greg Ward
Date April 25, 2014, 1:43 a.m.
Message ID <20140425014313.GC28877@gerg.ca>
Download mbox | patch
Permalink /patch/4438/
State Deferred
Headers show

Comments

Greg Ward - April 25, 2014, 1:43 a.m.
[my original bug report]
> At work, I've been using hgsubversion and evolve on top of Mercurial
> 2.9 quite happily for a couple of months now. In fact, it's gotten
> almost boring. So I updated my work machine to 3.0-rc+whatever this
> morning, and then updated to the tip of default for both evolve and
> hgsubversion. "hg push" to subversion crashed:
> 
> $ hg push
[...]
>    File "/home/gward/src/hg-stable/mercurial/commands.py", line 4712, in push
>      newbranch=opts.get('new_branch'))
>    File "/home/gward/src/hg-evolve/hgext/evolve.py", line 642, in push
>      result = super(evolvingrepo, self).push(remote, *args, **opts)
>    File "/home/gward/src/hgsubversion/hgsubversion/svnrepo.py", line 77, in wrapper
>      return fn(self, *args, **opts)
>    File "/home/gward/src/hgsubversion/hgsubversion/svnrepo.py", line 101, in push
>      return wrappers.push(self, remote, force, revs)
>    File "/home/gward/src/hgsubversion/hgsubversion/wrappers.py", line 346, in push
>      obsolete.createmarkers(repo, relations)
>    File "/home/gward/src/hg-stable/mercurial/extensions.py", line 196, in wrap
>      return wrapper(origfn, *args, **kwargs)
>    File "/home/gward/src/hg-evolve/hgext/evolve.py", line 332, in _createmarkers
>      relations[idx] = (prec, sucs, meta)
> TypeError: 'generator' object does not support item assignment

[Pierre-Yves]
> Evolve is adding some parent meta data to all created markers, It 
> assumed the list of marker was a list. hgsubversion give a generator. We 
> should probably makes evolve smarter there.

[Sean]
> I've seen this error before but had trouble reproducing it.

Good news #1: I get it pretty reliably when pushing to the svn repo at
work. It seems to have something to do with having obsolete changesets
when pushing via hgsubversion, but I *always* have obsolete
changesets. I hardly ever get anything right the first time.

Good news #2: I've hacked in a workaround patch to evolve (thanks to
Pierre-Yves for pointing me in the right direction):


Bad news #1: that's not a real fix! There are no tests!

Bad news #2: I'd rather not repeatedly push junk changesets to our
production svn repo at work. Need to setup a scratch svn repo to play
with.

Also, this smells like one of those unpleasant interactions where both
sides need to be fixed. I.e. evolve should accept any sequence, rather
than assuming a list; hgsubversion should send a list, not a
generator. "Be liberal in what you accept and conservative in what you
emit."

       Greg
Pierre-Yves David - April 25, 2014, 1:56 a.m.
On 04/24/2014 06:43 PM, Greg Ward wrote:
> Also, this smells like one of those unpleasant interactions where both
> sides need to be fixed. I.e. evolve should accept any sequence, rather
> than assuming a list; hgsubversion should send a list, not a
> generator. "Be liberal in what you accept and conservative in what you
> emit."

This logic should be moved into core. (will probably happens in 3.1) so 
we do not any hack in evolve anymore.

(please for forward and submit your patch to evolve)

Patch

--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -319,6 +319,7 @@ 
     # every time this test is run, a kitten is slain.
     # Change it as soon as possible
     if '[,{metadata}]' in orig.__doc__:
+        relations = list(relations)
         for idx, rel in enumerate(relations):
             prec = rel[0]
             sucs = rel[1]