Bug 4446 - `hg pull -f --rebase` crashes during rebase
Summary: `hg pull -f --rebase` crashes during rebase
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: rebase (show other bugs)
Version: 3.2
Hardware: PC Windows
: urgent bug
Assignee: Bugzilla
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2014-11-10 01:48 UTC by Anthony R
Modified: 2015-01-22 15:04 UTC (History)
5 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 Anthony R 2014-11-10 01:48 UTC
I have two repositories of the same project that are unrelated: One repo's history stops at a certain date, and the other repo starts with the project source at the state it was in when the first repo stopped. (Why I didn't use clone is a topic of discussion with my past self)

Both repos only have the default branch. 

Running `hg pull -f --rebase` encounters an exception when doing the rebase.

The output from the command is below.

pulling from ..\sukiyaki-sf
searching for changes
warning: repository is unrelated
requesting all changes
adding changesets
adding manifests
adding file changes
added 4 changesets with 13 changes to 22 files (+1 heads)
** unknown exception encountered, please report by visiting
** http://mercurial.selenic.com/wiki/BugTracker
** Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)]
** Mercurial Distributed SCM (version 3.2)
** Extensions loaded: convert, rebase
Traceback (most recent call last):
  File "hg", line 43, in <module>
  File "mercurial\dispatch.pyc", line 28, in run
  File "mercurial\dispatch.pyc", line 71, in dispatch
  File "mercurial\dispatch.pyc", line 140, in _runcatch
  File "mercurial\dispatch.pyc", line 850, in _dispatch
  File "mercurial\dispatch.pyc", line 611, in runcommand
  File "mercurial\dispatch.pyc", line 941, in _runcommand
  File "mercurial\dispatch.pyc", line 912, in checkargs
  File "mercurial\dispatch.pyc", line 847, in <lambda>
  File "mercurial\util.pyc", line 677, in check
  File "mercurial\extensions.pyc", line 151, in wrap
  File "mercurial\util.pyc", line 677, in check
  File "hgext\rebase.pyc", line 984, in pullrebase
  File "hgext\rebase.pyc", line 278, in rebase
  File "mercurial\localrepo.pyc", line 469, in revs
  File "mercurial\revset.pyc", line 2156, in formatspec
  File "mercurial\revset.pyc", line 2116, in argtype
TypeError: int() argument must be a string or a number, not 'NoneType'
Comment 1 Anthony R 2014-11-10 01:58 UTC
After further reading, it seems plausible this could be failing because the phase of the changes being pulled is 'public'.
Comment 2 Pierre-Yves David 2014-11-10 10:49 UTC
This is failing because the destination and the "base" from which the rebased-set is computed do not have a common ancestors.

The new code is not handling this case properly. This is likely a regression from a 3.1, upgrading to urgent.

cc-ing durham (who wrote the new code) and Jordi (who claim to repro)
Comment 3 Durham Goode 2014-11-10 13:47 UTC
Fix it out for review.
Comment 4 Jordi Gutiérrez Hermoso 2014-11-10 14:24 UTC
Anthony, the bug has been addressed, but even with that fix, I don't think you'll get the result that you want. Instead, you'll have to do `hg pull -f` and then do `hg rebase --source $some_root --dest $some_head`. Depending which repo you're force pulling into which one, $some_root should probably 0 and $some_head should be tip. Look at `hg log -r "roots(all())"` and `hg heads` to help you decide what to rebase onto what.
Comment 5 Anthony R 2014-11-10 23:24 UTC
Thanks, Jordi!
I'll try that instead.

Glad I could help by filing the bug.
Do you need me to repro/test the fix at all?
Comment 6 HG Bot 2014-11-11 18:31 UTC
Fixed by http://selenic.com/repo/hg/rev/643c58303fb0
Durham Goode <durham@fb.com>
rebase: fix rebase with no common ancestors (issue4446)

The new rebase revset didn't check for the case when there are no common
ancestors. Now it does. The new behavior should be the same as the pre-3.2
behavior. Added a test.

(please test the fix)
Comment 7 Matt Mackall 2015-01-22 15:04 UTC
Bulk testing -> fixed