[issue2842] Commit on subrepository that has been rebased can fail with 'unknown revision'

Ethan J Brown bugs at mercurial.selenic.com
Fri Jun 3 09:11:43 CDT 2011


New submission from Ethan J Brown <ethan_j_brown at hotmail.com>:

I generally understand the what/why of what's happening here, but I think this should 
somehow be handled by the client.  The follow script is for Windows cmd, adjust 
accordingly for other shells. Initially filed as a bug, though that might be arguable by the hg team 
based on implementation details.


md HgBug
cd HgBug
hg init Test
cd Test
ECHO first > first.txt
hg commit -A -m "Initial commit"
cd ..
hg init Test.Master
cd Test.Master
ECHO Test = ../Test > .hgsub
hg clone ../Test Test
hg commit -A -m "Initial commit"
cd ..
hg clone Test.Master Test.Local
cd Test
ECHO second > second.txt
hg commit -A -m "First Head commit"
cd ../Test.Local/Test
hg update
ECHO third > third.txt
hg commit -A -m "Second head commit"
cd ..
hg commit -A -m "Updated Test sub with second head"
hg push


The result is expectedly a failed push because of two heads -- standard fare there.

********************
pushing to c:\Source\HgBug\Test.Master
pushing subrepo Test to C:\Source\HgBug\Test.Master\../Test
searching for changes
abort: push creates new remote heads on branch 'default'!
(you should pull and merge or use push -f to force)
*********************

In this case, a rebase seems like a perfectly reasonable way to assemble the changesets 
together, since the changes were across isolated files and the 'Master' copy is our 
source of truth / remote shared repository.


cd Test
hg pull --rebase
cd ..
hg commit -m "Heads resolved"


The result is 

*******************
abort: unknown revision '370523db7b181049b5269e21c713f456be34b043'!
*********************

I get why this is the case, Test.Local is tracking a sub that no longer exists, based on 
the rebase being performed.  The only solution for a user is to grab the hash of the 
tip, manually edit .hgsubstate with it and commit.

I think that rebase needs to be made more subrepository aware, though I'm not sure the 
technical implications are.

----------
messages: 16452
nosy: Iristyle
priority: bug
status: unread
title: Commit on subrepository that has been rebased can fail with 'unknown revision'

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2842>
____________________________________________________


More information about the Mercurial-devel mailing list