Bug 3802 - traceback during hg rebase --continue
Summary: traceback during hg rebase --continue
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: rebase (show other bugs)
Version: earlier
Hardware: PC Linux
: urgent bug
Assignee: Siddharth Agarwal
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2013-02-03 08:33 UTC by Pierre-Yves David
Modified: 2017-11-01 18:05 UTC (History)
4 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Yves David 2013-02-03 08:33 UTC
2a1fac3650a5 introduce a new argument `dest` to updatebookmarks but the reference is not set in some code path:

> ** Unknown exception encountered with possibly-broken third-party extension crecord
> ** which supports versions unknown of Mercurial.
> ** Please disable crecord and try your action again.
> ** If that fixes the bug please report it to the extension author.
> ** Python 2.7.3 (default, Aug  1 2012, 05:14:39) [GCC 4.6.3]
> ** Mercurial Distributed SCM (version 2.5-rc+60-2a1fac3650a5)
> ** Extensions loaded: color, schemes, convert, rebase, mq, churn, purge, progress, patchbomb, graphlog, record, crecord, hgview, histedit, evolve, perf, extdiff
> Traceback (most recent call last):
>   File "/home/pyves/bin/hg", line 38, in <module>
>     mercurial.dispatch.run()
>   File "/home/pyves/lib/python/mercurial/dispatch.py", line 28, in run
>     sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
>   File "/home/pyves/lib/python/mercurial/dispatch.py", line 65, in dispatch
>     return _runcatch(req)
>   File "/home/pyves/lib/python/mercurial/dispatch.py", line 88, in _runcatch
>     return _dispatch(req)
>   File "/home/pyves/lib/python/mercurial/dispatch.py", line 743, in _dispatch
>     cmdpats, cmdoptions)
>   File "/home/pyves/lib/python/mercurial/dispatch.py", line 514, in runcommand
>     ret = _runcommand(ui, options, cmd, d)
>   File "/home/pyves/lib/python/mercurial/extensions.py", line 189, in wrap
>     return wrapper(origfn, *args, **kwargs)
>   File "/home/pyves/lib/python/hgext/color.py", line 394, in colorcmd
>     return orig(ui_, opts, cmd, cmdfunc)
>   File "/home/pyves/lib/python/mercurial/dispatch.py", line 833, in _runcommand
>     return checkargs()
>   File "/home/pyves/lib/python/mercurial/dispatch.py", line 804, in checkargs
>     return cmdfunc()
>   File "/home/pyves/lib/python/mercurial/dispatch.py", line 740, in <lambda>
>     d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
>   File "/home/pyves/lib/python/mercurial/util.py", line 475, in check
>     return func(*args, **kwargs)
>   File "/home/pyves/lib/python/mercurial/extensions.py", line 144, in wrap
>     util.checksignature(origfn), *args, **kwargs)
>   File "/home/pyves/lib/python/mercurial/util.py", line 475, in check
>     return func(*args, **kwargs)
>   File "/home/pyves/lib/python/hgext/mq.py", line 3508, in mqcommand
>     return orig(ui, repo, *args, **kwargs)
>   File "/home/pyves/lib/python/mercurial/util.py", line 475, in check
>     return func(*args, **kwargs)
>   File "/home/pyves/lib/python/mercurial/extensions.py", line 144, in wrap
>     util.checksignature(origfn), *args, **kwargs)
>   File "/home/pyves/lib/python/mercurial/util.py", line 475, in check
>     return func(*args, **kwargs)
>   File "/home/pyves/lib/python/hgext/evolve.py", line 594, in warnobserrors
>     ret = orig(ui, repo, *args, **kwargs)
>   File "/home/pyves/lib/python/mercurial/util.py", line 475, in check
>     return func(*args, **kwargs)
>   File "/home/pyves/lib/python/hgext/rebase.py", line 327, in rebase
>     updatebookmarks(repo, dest, nstate, currentbookmarks)
> UnboundLocalError: local variable 'dest' referenced before assignment

Rebase is left in a bad state

> > hg rebase --abort
> abort: 00changelog.i@b20612afa540: no node!
>
Comment 1 Pierre-Yves David 2013-02-03 08:53 UTC
Below is a simple repro of the error. upgrading to critical

diff --git a/tests/test-rebase-bookmarks.t b/tests/test-rebase-bookmarks.t
--- a/tests/test-rebase-bookmarks.t
+++ b/tests/test-rebase-bookmarks.t
@@ -126,6 +126,36 @@ Keep active bookmark on the correct chan
   o  1: 'D' bookmarks: W
   |
   o  0: 'A' bookmarks:
   
 
-  $ cd ..
+Rebase --continue with active bookmark
+
+  $ hg up 2
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo 'C' > c
+  $ hg add c
+  $ hg commit --message 'other C'
+  created new head
+  $ hg up Y
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg rebase
+  merging c
+  warning: conflicts during merge.
+  merging c incomplete! (edit conflicts, then use 'hg resolve --mark')
+  abort: unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [255]
+  $ echo 'c' > c
+  $ hg resolve --mark c
+  $ hg rebase --continue
+  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/3d5fa227f4b5-backup.hg
+  $ hg tglog
+  @  4: 'C' bookmarks: Y Z
+  |
+  o  3: 'other C' bookmarks:
+  |
+  o  2: 'B' bookmarks: X
+  |
+  o  1: 'D' bookmarks: W
+  |
+  o  0: 'A' bookmarks:
+
Comment 2 Pierre-Yves David 2013-02-03 09:04 UTC
testing changeset available at

http://hg-lab.logilab.org/wip/hg/rev/issue3802
Comment 3 Matt Mackall 2013-02-03 13:45 UTC
"critical - data loss or security issue"

That doesn't seem to apply, back to urgent.
Comment 4 Matt Mackall 2013-02-03 15:56 UTC
If you ever write "<changeset> introduced a bug" or "bisected to <changeset>", please:

a) paste/link the shortlog of that changeset
b) cc that developer

Otherwise:

a) everyone else WILL have to look up that changeset just to figure out the context.. every time they look at the report
b) there's no guarantee the dev in question will ever notice the bug is their problem

changeset:   18514:2a1fac3650a5
branch:      stable
bookmark:    reviewed
user:        Siddharth Agarwal <sid0@fb.com>
date:        Wed Jan 30 16:08:32 2013 -0800
summary:     rebase: delete divergent bookmarks on destination (issue3685)
Comment 5 HG Bot 2013-02-04 15:30 UTC
Fixed by http://selenic.com/repo/hg/rev/12de53323e59
Siddharth Agarwal <sid0@fb.com>
rebase: derive node from target rev (issue3802)

dest.rev() is the same as target when a new rebase is run, but dest
isn't set when rebase --continue is run. Bug introduced in 2a1fac3650a5,
which fixed issue3685.

(please test the fix)