##// END OF EJS Templates
subrepo: print paths relative to upper repo root for push/pull/commit...
Edouard Gomez -
r11112:4a9bee61 default
parent child Browse files
Show More
@@ -867,8 +867,10 b' class localrepository(repo.repository):'
867 if subs or removedsubs:
867 if subs or removedsubs:
868 state = wctx.substate.copy()
868 state = wctx.substate.copy()
869 for s in subs:
869 for s in subs:
870 self.ui.status(_('committing subrepository %s\n') % s)
870 sub = wctx.sub(s)
871 sr = wctx.sub(s).commit(cctx._text, user, date)
871 self.ui.status(_('committing subrepository %s\n') %
872 subrepo.relpath(sub))
873 sr = sub.commit(cctx._text, user, date)
872 state[s] = (state[s][0], sr)
874 state[s] = (state[s][0], sr)
873 subrepo.writestate(self, state)
875 subrepo.writestate(self, state)
874
876
@@ -126,6 +126,14 b' def submerge(repo, wctx, mctx, actx):'
126 # record merged .hgsubstate
126 # record merged .hgsubstate
127 writestate(repo, sm)
127 writestate(repo, sm)
128
128
129 def relpath(sub):
130 if not hasattr(sub, '_repo'):
131 return sub._path
132 parent = sub._repo
133 while hasattr(parent, '_subparent'):
134 parent = parent._subparent
135 return sub._repo.root[len(parent.root)+1:]
136
129 def _abssource(repo, push=False):
137 def _abssource(repo, push=False):
130 if hasattr(repo, '_subparent'):
138 if hasattr(repo, '_subparent'):
131 source = repo._subsource
139 source = repo._subsource
@@ -214,7 +222,7 b' class hgsubrepo(object):'
214 return w.dirty() # working directory changed
222 return w.dirty() # working directory changed
215
223
216 def commit(self, text, user, date):
224 def commit(self, text, user, date):
217 self._repo.ui.debug("committing subrepo %s\n" % self._path)
225 self._repo.ui.debug("committing subrepo %s\n" % relpath(self))
218 n = self._repo.commit(text, user, date)
226 n = self._repo.commit(text, user, date)
219 if not n:
227 if not n:
220 return self._repo['.'].hex() # different version checked out
228 return self._repo['.'].hex() # different version checked out
@@ -223,7 +231,7 b' class hgsubrepo(object):'
223 def remove(self):
231 def remove(self):
224 # we can't fully delete the repository as it may contain
232 # we can't fully delete the repository as it may contain
225 # local-only history
233 # local-only history
226 self._repo.ui.note(_('removing subrepo %s\n') % self._path)
234 self._repo.ui.note(_('removing subrepo %s\n') % relpath(self))
227 hg.clean(self._repo, node.nullid, False)
235 hg.clean(self._repo, node.nullid, False)
228
236
229 def _get(self, state):
237 def _get(self, state):
@@ -234,7 +242,7 b' class hgsubrepo(object):'
234 self._repo._subsource = source
242 self._repo._subsource = source
235 srcurl = _abssource(self._repo)
243 srcurl = _abssource(self._repo)
236 self._repo.ui.status(_('pulling subrepo %s from %s\n')
244 self._repo.ui.status(_('pulling subrepo %s from %s\n')
237 % (self._path, srcurl))
245 % (relpath(self), srcurl))
238 other = hg.repository(self._repo.ui, srcurl)
246 other = hg.repository(self._repo.ui, srcurl)
239 self._repo.pull(other)
247 self._repo.pull(other)
240
248
@@ -250,12 +258,12 b' class hgsubrepo(object):'
250 dst = self._repo[state[1]]
258 dst = self._repo[state[1]]
251 anc = dst.ancestor(cur)
259 anc = dst.ancestor(cur)
252 if anc == cur:
260 if anc == cur:
253 self._repo.ui.debug("updating subrepo %s\n" % self._path)
261 self._repo.ui.debug("updating subrepo %s\n" % relpath(self))
254 hg.update(self._repo, state[1])
262 hg.update(self._repo, state[1])
255 elif anc == dst:
263 elif anc == dst:
256 self._repo.ui.debug("skipping subrepo %s\n" % self._path)
264 self._repo.ui.debug("skipping subrepo %s\n" % relpath(self))
257 else:
265 else:
258 self._repo.ui.debug("merging subrepo %s\n" % self._path)
266 self._repo.ui.debug("merging subrepo %s\n" % relpath(self))
259 hg.merge(self._repo, state[1], remind=False)
267 hg.merge(self._repo, state[1], remind=False)
260
268
261 def push(self, force):
269 def push(self, force):
@@ -268,7 +276,7 b' class hgsubrepo(object):'
268
276
269 dsturl = _abssource(self._repo, True)
277 dsturl = _abssource(self._repo, True)
270 self._repo.ui.status(_('pushing subrepo %s to %s\n') %
278 self._repo.ui.status(_('pushing subrepo %s to %s\n') %
271 (self._path, dsturl))
279 (relpath(self), dsturl))
272 other = hg.repository(self._repo.ui, dsturl)
280 other = hg.repository(self._repo.ui, dsturl)
273 return self._repo.push(other, force)
281 return self._repo.push(other, force)
274
282
@@ -50,7 +50,7 b' path sub2'
50 revision c57a0840e3badd667ef3c3ef65471609acb2ba3c
50 revision c57a0840e3badd667ef3c3ef65471609acb2ba3c
51 % Modifying deeply nested sub2
51 % Modifying deeply nested sub2
52 committing subrepository sub1
52 committing subrepository sub1
53 committing subrepository sub2
53 committing subrepository sub1/sub2
54 % Checking modified node ids
54 % Checking modified node ids
55 cloned ffe6649062fe tip
55 cloned ffe6649062fe tip
56 cloned/sub1 2ecb03bf44a9 tip
56 cloned/sub1 2ecb03bf44a9 tip
@@ -129,7 +129,7 b' adding changesets'
129 adding manifests
129 adding manifests
130 adding file changes
130 adding file changes
131 added 4 changesets with 5 changes to 3 files
131 added 4 changesets with 5 changes to 3 files
132 pulling subrepo ss from .../sub/t/s/ss
132 pulling subrepo s/ss from .../sub/t/s/ss
133 requesting all changes
133 requesting all changes
134 adding changesets
134 adding changesets
135 adding manifests
135 adding manifests
General Comments 0
You need to be logged in to leave comments. Login now