[issue2699] hg rm .hgsub*; hg merge; produces an empty .hgsubstate file

Matthew Watson bugs at mercurial.selenic.com
Tue Mar 15 06:54:35 UTC 2011


New submission from Matthew Watson <mattw.watson at gmail.com>:

Could be related to http://mercurial.selenic.com/bts/issue2558

If you remove a subrepository (or all of them) by doing

$ hg rm .hgsub*; hg commit

the files are removed. however, a subsequent merge recreates the .hgsubstate file as an empty file. I'll 
attach a zipped repo 
deonstrating and the list of command I ran:

hg init hgsubbug
cd hgsubbug
echo "foo=ssh://hg@bitbucket.org/fecru/fecru-devmode" > .hgsub
echo foo > foo.txt
hg add
hg commit -m "initial"
hg rm .hgsub .hgsubstate
hg commit -m "remove subrepo"

Note at this point, the .hgsubstate still exists, but is not tracked. If I do a hg log -v, ".hgsubstate" is 
in the files list twice!

hg up -C 0
echo "blah" >> foo.txt
hg commit -m "mod foo"
hg up 1
hg merge
hg commit -m "merge"

Now, .hgsubstate exists and is tracked but has 0 size. And:

$ hg dbsh
loaded repo : /Users/mwatson/work/crucible/feinsts/hgsubbug
using source: /Library/Python/2.6/site-packages/mercurial
>>> repo[3]['.hgsubstate']
<filectx .hgsubstate at eff7c86ff773>
>>> repo[3]['.hgsubstate'].linkrev()
1
>>> repo[1]['.hgsubstate']
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Library/Python/2.6/site-packages/mercurial/context.py", line 84, in __getitem__
    return self.filectx(key)
  File "/Library/Python/2.6/site-packages/mercurial/context.py", line 172, in filectx
    fileid = self.filenode(path)
  File "/Library/Python/2.6/site-packages/mercurial/context.py", line 161, in filenode
    return self._fileinfo(path)[0]
  File "/Library/Python/2.6/site-packages/mercurial/context.py", line 156, in _fileinfo
    _('not found in manifest'))
LookupError: .hgsubstate at f69c573da1d1: not found in manifest

i.e. looks to me like the manifest contains the filectx that was created when the .hgsubstate was deleted.

$ hg --version
Mercurial Distributed SCM (version 1.7.3+20110102)
(see http://mercurial.selenic.com for more information)

Just verified same with:
$ hg --version
Mercurial Distributed SCM (version 1.8.1+20110310)
(see http://mercurial.selenic.com for more information)

----------
messages: 15650
nosy: mattw_watson
priority: bug
status: unread
title: hg rm .hgsub*;hg merge; produces an empty .hgsubstate file

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


More information about the Mercurial-devel mailing list