comparison mercurial/commands.py @ 12852:5dbff89cf107 stable

subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 27 Oct 2010 00:28:40 +0200
parents 4d657b524be8
children 60d9692921ea
comparison
equal deleted inserted replaced
12851:765c98f068d3 12852:5dbff89cf107
2782 raise util.Abort(err) 2782 raise util.Abort(err)
2783 2783
2784 modheads = repo.pull(other, heads=revs, force=opts.get('force')) 2784 modheads = repo.pull(other, heads=revs, force=opts.get('force'))
2785 if checkout: 2785 if checkout:
2786 checkout = str(repo.changelog.rev(other.lookup(checkout))) 2786 checkout = str(repo.changelog.rev(other.lookup(checkout)))
2787 return postincoming(ui, repo, modheads, opts.get('update'), checkout) 2787 repo._subtoppath = source
2788 try:
2789 return postincoming(ui, repo, modheads, opts.get('update'), checkout)
2790 finally:
2791 del repo._subtoppath
2788 2792
2789 def push(ui, repo, dest=None, **opts): 2793 def push(ui, repo, dest=None, **opts):
2790 """push changes to the specified destination 2794 """push changes to the specified destination
2791 2795
2792 Push changesets from the local repository to the specified 2796 Push changesets from the local repository to the specified
2821 other = hg.repository(hg.remoteui(repo, opts), dest) 2825 other = hg.repository(hg.remoteui(repo, opts), dest)
2822 ui.status(_('pushing to %s\n') % url.hidepassword(dest)) 2826 ui.status(_('pushing to %s\n') % url.hidepassword(dest))
2823 if revs: 2827 if revs:
2824 revs = [repo.lookup(rev) for rev in revs] 2828 revs = [repo.lookup(rev) for rev in revs]
2825 2829
2826 # push subrepos depth-first for coherent ordering 2830 repo._subtoppath = dest
2827 c = repo[''] 2831 try:
2828 subs = c.substate # only repos that are committed 2832 # push subrepos depth-first for coherent ordering
2829 for s in sorted(subs): 2833 c = repo['']
2830 if not c.sub(s).push(opts.get('force')): 2834 subs = c.substate # only repos that are committed
2831 return False 2835 for s in sorted(subs):
2832 2836 if not c.sub(s).push(opts.get('force')):
2837 return False
2838 finally:
2839 del repo._subtoppath
2833 r = repo.push(other, opts.get('force'), revs=revs, 2840 r = repo.push(other, opts.get('force'), revs=revs,
2834 newbranch=opts.get('new_branch')) 2841 newbranch=opts.get('new_branch'))
2835 return r == 0 2842 return r == 0
2836 2843
2837 def recover(ui, repo): 2844 def recover(ui, repo):