Bug 3518 - Mercurial share extension doesn't work with nested subrepos
Summary: Mercurial share extension doesn't work with nested subrepos
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: share (show other bugs)
Version: earlier
Hardware: PC Linux
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-28 07:06 UTC by mericmats
Modified: 2017-11-01 18:05 UTC (History)
3 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 mericmats 2012-06-28 07:06 UTC
I can't get mercurial share extension to work with nested repos.

Test repository structure:

    SubrepoTest/
        nested/

The SubrepoTest/.hgsub content:

nested = nested


When using share on the repo on Ubuntu Linux Maverick, with Mercurial Distributed SCM (version 2.2.1) (built locally from source) I get this output:

hg share --traceback SubrepoTest/ sharetest
updating working directory
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 87, in _runcatch
    return _dispatch(req)
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 685, in _dispatch
    cmdpats, cmdoptions)
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 467, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 775, in _runcommand
    return checkargs()
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 746, in checkargs
    return cmdfunc()
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 682, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/lib/pymodules/python2.6/mercurial/util.py", line 463, in check
    return func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/hgext/share.py", line 29, in share
    return hg.share(ui, source, dest, not noupdate)
  File "/usr/lib/pymodules/python2.6/mercurial/hg.py", line 175, in share
    _update(r, uprev)
  File "/usr/lib/pymodules/python2.6/mercurial/hg.py", line 416, in update
    stats = mergemod.update(repo, node, False, False, None)
  File "/usr/lib/pymodules/python2.6/mercurial/merge.py", line 596, in update
    stats = applyupdates(repo, action, wc, p2, pa, overwrite)
  File "/usr/lib/pymodules/python2.6/mercurial/merge.py", line 391, in applyupdates
    subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
  File "/usr/lib/pymodules/python2.6/mercurial/subrepo.py", line 175, in submerge
    mctx.sub(s).get(r)
  File "/usr/lib/pymodules/python2.6/mercurial/subrepo.py", line 504, in get
    self._get(state)
  File "/usr/lib/pymodules/python2.6/mercurial/subrepo.py", line 486, in _get
    srcurl = _abssource(self._repo)
  File "/usr/lib/pymodules/python2.6/mercurial/subrepo.py", line 239, in _abssource
    reporelpath(repo))
Abort: default path for subrepository nested not found
abort: default path for subrepository nested not found


On Mercurial Distributed SCM (version 2.2.2) from TortoiseHG for Windows I get the following:

hg share --debug --traceback SubrepoTest Copy
updating working directory
resolving manifests
 overwrite: False, partial: False
 ancestor: 000000000000, local: 000000000000+, remote: 9d3080714601
 .hgsub: remote created -> g
 .hgsubstate: remote created -> g
 New Text Document.txt: remote created -> g
calling hook preupdate.auto_update_hooks: 
calling hook preupdate.auto_rhapsody: 
Rhapsody not running.
updating: .hgsub 1/3 files (33.33%)
getting .hgsub
updating: .hgsubstate 2/3 files (66.67%)
getting .hgsubstate
subrepo merge 000000000000+ 9d3080714601 000000000000+
  subrepo nested: remote added, get nested:6a97f6c97cf7b1fd1bd82cb528a7494980e17d62:hg
Traceback (most recent call last):
  File "mercurial\dispatch.pyo", line 87, in _runcatch
  File "mercurial\dispatch.pyo", line 696, in _dispatch
  File "mercurial\dispatch.pyo", line 472, in runcommand
  File "mercurial\extensions.pyo", line 184, in wrap
  File "hgext\color.pyo", line 362, in colorcmd
  File "mercurial\dispatch.pyo", line 786, in _runcommand
  File "mercurial\dispatch.pyo", line 757, in checkargs
  File "mercurial\dispatch.pyo", line 693, in 
  File "mercurial\util.pyo", line 463, in check
  File "hgext\share.pyo", line 29, in share
  File "mercurial\hg.pyo", line 175, in share
  File "mercurial\hg.pyo", line 416, in update
  File "mercurial\merge.pyo", line 596, in update
  File "mercurial\merge.pyo", line 391, in applyupdates
  File "mercurial\subrepo.pyo", line 183, in submerge
  File "mercurial\subrepo.pyo", line 512, in get
  File "mercurial\subrepo.pyo", line 494, in _get
  File "mercurial\subrepo.pyo", line 247, in _abssource
Abort: default path for subrepository nested not found
abort: default path for subrepository nested not found
Comment 1 Patrick Mézard 2012-07-26 10:13 UTC
Test script for those interested:

  $ echo '[extensions]' >> $HGRCPATH
  $ echo 'share =' >> $HGRCPATH

  $ hg init repo
  $ cd repo
  $ echo a > a
  $ hg init sub
  $ echo b > sub/b
  $ hg --cwd sub ci -Am addab b
  $ cat > .hgsub <<EOF
  > sub = sub
  > EOF
  $ hg add .hgsub
  $ hg ci -Am addsub
  adding a
  $ cd ..

  $ hg share repo shared
  updating working directory
  abort: default path for subrepository sub not found
  [255]
Comment 2 HG Bot 2012-11-15 17:15 UTC
Fixed by http://selenic.com/repo/hg/rev/fd903f89e42b
simon@laptop-tosh
share: always set default path to work with subrepos (issue3518)

set the default path in any case because creating subrepo looks this up.
Subrepos are cloned, not shared.

(please test the fix)