##// END OF EJS Templates
subrepo: basic push support
Matt Mackall -
r8815:e87b0fc4 default
parent child Browse files
Show More
@@ -2289,6 +2289,13 b' def push(ui, repo, dest=None, **opts):'
2289 ui.status(_('pushing to %s\n') % url.hidepassword(dest))
2289 ui.status(_('pushing to %s\n') % url.hidepassword(dest))
2290 if revs:
2290 if revs:
2291 revs = [repo.lookup(rev) for rev in revs]
2291 revs = [repo.lookup(rev) for rev in revs]
2292
2293 # push subrepos depth-first for coherent ordering
2294 c = repo['']
2295 subs = c.substate # only repos that are committed
2296 for s in sorted(subs):
2297 c.sub(s).push(opts.get('force'))
2298
2292 r = repo.push(other, opts.get('force'), revs=revs)
2299 r = repo.push(other, opts.get('force'), revs=revs)
2293 return r == 0
2300 return r == 0
2294
2301
@@ -102,12 +102,14 b' def submerge(repo, wctx, mctx, actx):'
102 # record merged .hgsubstate
102 # record merged .hgsubstate
103 writestate(repo, sm)
103 writestate(repo, sm)
104
104
105 def _abssource(repo):
105 def _abssource(repo, push=False):
106 if hasattr(repo, '_subparent'):
106 if hasattr(repo, '_subparent'):
107 source = repo._subsource
107 source = repo._subsource
108 if source.startswith('/') or '://' in source:
108 if source.startswith('/') or '://' in source:
109 return source
109 return source
110 return os.path.join(_abssource(repo._subparent), repo._subsource)
110 return os.path.join(_abssource(repo._subparent), repo._subsource)
111 if push and repo.ui.config('paths', 'default-push'):
112 return repo.ui.config('paths', 'default-push', repo.root)
111 return repo.ui.config('paths', 'default', repo.root)
113 return repo.ui.config('paths', 'default', repo.root)
112
114
113 def subrepo(ctx, path):
115 def subrepo(ctx, path):
@@ -127,7 +129,6 b' def subrepo(ctx, path):'
127
129
128 class hgsubrepo(object):
130 class hgsubrepo(object):
129 def __init__(self, ctx, path, state):
131 def __init__(self, ctx, path, state):
130 self._parent = ctx
131 self._path = path
132 self._path = path
132 self._state = state
133 self._state = state
133 r = ctx._repo
134 r = ctx._repo
@@ -176,3 +177,16 b' class hgsubrepo(object):'
176
177
177 def merge(self, state):
178 def merge(self, state):
178 hg.merge(self._repo, state[1], remind=False)
179 hg.merge(self._repo, state[1], remind=False)
180
181 def push(self, force):
182 # push subrepos depth-first for coherent ordering
183 c = self._repo['']
184 subs = c.substate # only repos that are committed
185 for s in sorted(subs):
186 c.sub(s).push(force)
187
188 self._repo.ui.status(_('pushing subrepo %s\n') % self._path)
189 dsturl = _abssource(self._repo, True)
190 other = hg.repository(self._repo.ui, dsturl)
191 self._repo.push(other, force)
192
General Comments 0
You need to be logged in to leave comments. Login now