Issue #7 resolved

hgcollapse breaks with Mercurial version 2.3 with TypeError: 'int' object is not iterable

Anonymous created an issue

Trying to use the collapse extension I get:

{{{

!python

hg collapse -r 3049 -r 3050 Unknown exception encountered with possibly-broken third-party extension collapse which supports versions unknown of Mercurial. Please disable collapse and try your action again. If that fixes the bug please report it to the extension author. Python 2.7.2+ (default, Oct 4 2011, 20:03:08) [GCC 4.6.1] Mercurial Distributed SCM (version 2.3) Extensions loaded: collapse Traceback (most recent call last): File "/usr/bin/hg", line 38, in <module> mercurial.dispatch.run() File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 28, in run sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 65, in dispatch return _runcatch(req) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 88, in _runcatch return _dispatch(req) ... ret = _runcommand(ui, options, cmd, d) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 830, in _runcommand return checkargs() File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 801, in checkargs return cmdfunc() File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 737, in <lambda> d = lambda: util.checksignature(func)(ui, *args, cmdoptions) File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 472, in check return func(args, *kwargs) File "/home/andi/bin/hg-extensions/hgcollapse/hgext/collapse.py", line 77, in collapse opts) File "/home/andi/bin/hg-extensions/hgcollapse/hgext/collapse.py", line 148, in do_collapse tomove = list(repo.changelog.descendants(last)) File "/usr/lib/python2.7/dist-packages/mercurial/revlog.py", line 370, in descendants first = min(revs) TypeError: 'int' object is not iterable }}}

Comments (21)

  1. Peer Stritzinger repo owner

    First I was thinking its your multiple use of -r but I tried this and it works for me.

    Note however that normally collapse works on ranges -r from:to

    Can you try using

    -r 3049:3050
    

    in your call instead and see if the error changes.

    Because so far I can't reproduce your problem.

  2. hokorobi

    I am also the same condition. I use Mercurial 2.3, collapse rev.70. It does not happen in Mercurial 2.2.3.

    Although this does not know whether it is the cause, Mercurial 2.3, change "def descendants" in revlog.py. It change "def descendants(self, *revs):" to "def descendants(self, revs):".

  3. Alexandre Patry

    The following patch solved this for me :

    diff -r a497ed6d9d7d hgext/collapse.py
    --- a/hgext/collapse.py	Fri Jan 13 20:10:34 2012 +0100
    +++ b/hgext/collapse.py	Mon Aug 20 03:06:13 2012 -0400
    @@ -145,7 +145,7 @@
             cmdutil.bail_if_changed(repo)
     
         parent = repo[first].parents()[0]
    -    tomove = list(repo.changelog.descendants(last))
    +    tomove = list(repo.changelog.descendants([last]))
     
         head_hgtags = get_hgtags_from_heads(ui, repo, last)
         if '.hgtags' in parent:
    
  4. Brice Dutheil

    Not for me: I have a diff between the output of 'hg cat' (yes the content is the help of hg cat) and the last file I wanted to modify, the history is corrupted as well.

    thx anyway

  5. Pablo Carranza

    I had this issue too using mercurial 2.3.1, installing mercurial from ppa repository in an ubuntu 11.10. I've manually modified as Alexander proposed and it's working perfectly now.

    No repository corruption whatsoever.

    One but: got a message "abort: Mercurial version to low (1.9.1), you need at least 2.0" despite "Caution: this needs at least Mercurial 1.9.1 and will not run under older versions" is declared in this very page.

  6. Peer Stritzinger repo owner

    For my understanding you got the "version too low" error when running under 2.3.1 ?

    I have to update my test suite before I use this patch, the repo corruption that happened to Brice Dutheil scares me a bit. Unfortunately no further info about the corruption ... :-(

  7. Peer Stritzinger repo owner

    As others have said above the patch provided by Alexandre seems to work.

    I'm pretty busy at the moment and can't integrate it into hgcollapse since I want to update the testsuite to run on the current version also which seems to be a bit of work.

    If you want to try the patch above and tell us how it works, that would be nice. I'd try it on a clone of a repo first to see if it works.

    I was careful because one user reported repo corruption which seems not to be shared by the other users.

  8. Log in to comment