##// 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 2289 ui.status(_('pushing to %s\n') % url.hidepassword(dest))
2290 2290 if revs:
2291 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 2299 r = repo.push(other, opts.get('force'), revs=revs)
2293 2300 return r == 0
2294 2301
@@ -102,12 +102,14 b' def submerge(repo, wctx, mctx, actx):'
102 102 # record merged .hgsubstate
103 103 writestate(repo, sm)
104 104
105 def _abssource(repo):
105 def _abssource(repo, push=False):
106 106 if hasattr(repo, '_subparent'):
107 107 source = repo._subsource
108 108 if source.startswith('/') or '://' in source:
109 109 return source
110 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 113 return repo.ui.config('paths', 'default', repo.root)
112 114
113 115 def subrepo(ctx, path):
@@ -127,7 +129,6 b' def subrepo(ctx, path):'
127 129
128 130 class hgsubrepo(object):
129 131 def __init__(self, ctx, path, state):
130 self._parent = ctx
131 132 self._path = path
132 133 self._state = state
133 134 r = ctx._repo
@@ -176,3 +177,16 b' class hgsubrepo(object):'
176 177
177 178 def merge(self, state):
178 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