[Bug 4106] New: in rebase - UnboundLocalError: local variable 'base' referenced before assignment

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Tue Nov 19 15:57:33 CST 2013


http://bz.selenic.com/show_bug.cgi?id=4106

          Priority: normal
            Bug ID: 4106
                CC: mercurial-devel at selenic.com
          Assignee: bugzilla at selenic.com
           Summary: in rebase - UnboundLocalError: local variable 'base'
                    referenced before assignment
          Severity: bug
    Classification: Unclassified
                OS: Windows
          Reporter: simohe at besonet.ch
          Hardware: PC
            Status: UNCONFIRMED
           Version: 2.8
         Component: rebase
           Product: Mercurial

When running evolve, I get this traceback:

> hg evolve --debug
15372 [<changectx 9852d5df4029>, <changectx d093b2c2ec2a>]
15373
move:[15373] graph: only draw one line to one parent
atop:[15373] graph: only draw one line to one parent
hg rebase -r 21bd5c49cfb0 -d 21bd5c49cfb0
 already in target
 merge against 15373:21bd5c49cfb0
** Unknown exception encountered with possibly-broken third-party extension
evol
ve
** which supports versions 2.5 of Mercurial.
** Please disable evolve and try your action again.
** If that fixes the bug please report it to
https://bitbucket.org/marmoute/muta
ble-history/issues
** Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)]
** Mercurial Distributed SCM (version 2.8)
** Extensions loaded: evolve, rebase
Traceback (most recent call last):
  File "hg", line 42, in <module>
  File "mercurial\dispatch.pyo", line 28, in run
  File "mercurial\dispatch.pyo", line 69, in dispatch
  File "mercurial\dispatch.pyo", line 133, in _runcatch
  File "mercurial\dispatch.pyo", line 806, in _dispatch
  File "mercurial\dispatch.pyo", line 585, in runcommand
  File "mercurial\dispatch.pyo", line 897, in _runcommand
  File "mercurial\dispatch.pyo", line 868, in checkargs
  File "mercurial\dispatch.pyo", line 803, in <lambda>
  File "mercurial\util.pyo", line 512, in check
  File "C:\Users\simon\Documents\src\hg\mutable-history\hgext\evolve.py", line
8
95, in evolve
    result = _evolveany(ui, repo, tr, dryrunopt)
  File "C:\Users\simon\Documents\src\hg\mutable-history\hgext\evolve.py", line
9
07, in _evolveany
    return _solveunstable(ui, repo, tr, dryrunopt)
  File "C:\Users\simon\Documents\src\hg\mutable-history\hgext\evolve.py", line
9
95, in _solveunstable
    relocate(repo, orig, target)
  File "C:\Users\simon\Documents\src\hg\mutable-history\hgext\evolve.py", line
7
78, in relocate
    {node.nullrev: node.nullrev}, False)
  File "hgext\rebase.pyo", line 487, in rebasenode
UnboundLocalError: local variable 'base' referenced before assignment


The failure happens around this lines (changed in ad9db007656f)


#### X is the failing line:
 def rebasenode(repo, rev, p1, state, collapse):
...
     if repo[rev].rev() == repo[min(state)].rev():
...
     elif not repo[rev].p2():
...
     else:
...
         # conflicts.
         for p in repo[rev].parents():
             if state.get(p.rev()) == repo[p1].rev():
                 base = p.node()
                 break
X    if base is not None:
         repo.ui.debug("   detach base %d:%s\n" % (repo[base].rev(),
repo[base]))
...
problem: no parent has been selected in the for loop


More details from running hg evolve --debugger:
(Pdb) repo[rev].rev(), repo[min(state)].rev() # in if   => result is false
(15373, -1)
(Pdb) repo[rev].p2() # in elif     => result is false
<changectx d093b2c2ec2a>

(Pdb) repo[rev].parents() # in for
[<changectx 9852d5df4029>, <changectx d093b2c2ec2a>]
(Pdb) state
{-1: -1}
(Pdb) [_p.rev() for _p in repo[rev].parents()] # is NOT in state
[15372, 15369]
(Pdb) repo[p1].rev()
15373

(Pdb) base
*** NameError: name 'base' is not defined


State was provided by the caller. Maybe this variable is wrong (a constant in
line 778 of evolve.py).
But an UnboundLocalError should not raise anyway.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list