Show More
@@ -249,7 +249,7 b' def manifestmerge(repo, p1, p2, pa, over' | |||
|
249 | 249 | def actionkey(a): |
|
250 | 250 | return a[1] == 'r' and -1 or 0, a |
|
251 | 251 | |
|
252 | def applyupdates(repo, action, wctx, mctx, actx): | |
|
252 | def applyupdates(repo, action, wctx, mctx, actx, overwrite): | |
|
253 | 253 | """apply the merge action list to the working directory |
|
254 | 254 | |
|
255 | 255 | wctx is the working copy context |
@@ -307,7 +307,7 b' def applyupdates(repo, action, wctx, mct' | |||
|
307 | 307 | repo.ui.note(_("removing %s\n") % f) |
|
308 | 308 | audit_path(f) |
|
309 | 309 | if f == '.hgsubstate': # subrepo states need updating |
|
310 | subrepo.submerge(repo, wctx, mctx, wctx) | |
|
310 | subrepo.submerge(repo, wctx, mctx, wctx, overwrite) | |
|
311 | 311 | try: |
|
312 | 312 | util.unlink(repo.wjoin(f)) |
|
313 | 313 | except OSError, inst: |
@@ -317,7 +317,7 b' def applyupdates(repo, action, wctx, mct' | |||
|
317 | 317 | removed += 1 |
|
318 | 318 | elif m == "m": # merge |
|
319 | 319 | if f == '.hgsubstate': # subrepo states need updating |
|
320 | subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx)) | |
|
320 | subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), overwrite) | |
|
321 | 321 | continue |
|
322 | 322 | f2, fd, flags, move = a[2:] |
|
323 | 323 | r = ms.resolve(fd, wctx, mctx) |
@@ -340,7 +340,7 b' def applyupdates(repo, action, wctx, mct' | |||
|
340 | 340 | t = None |
|
341 | 341 | updated += 1 |
|
342 | 342 | if f == '.hgsubstate': # subrepo states need updating |
|
343 | subrepo.submerge(repo, wctx, mctx, wctx) | |
|
343 | subrepo.submerge(repo, wctx, mctx, wctx, overwrite) | |
|
344 | 344 | elif m == "d": # directory rename |
|
345 | 345 | f2, fd, flags = a[2:] |
|
346 | 346 | if f: |
@@ -529,7 +529,7 b' def update(repo, node, branchmerge, forc' | |||
|
529 | 529 | if not partial: |
|
530 | 530 | repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) |
|
531 | 531 | |
|
532 | stats = applyupdates(repo, action, wc, p2, pa) | |
|
532 | stats = applyupdates(repo, action, wc, p2, pa, overwrite) | |
|
533 | 533 | |
|
534 | 534 | if not partial: |
|
535 | 535 | repo.dirstate.setparents(fp1, fp2) |
@@ -82,7 +82,7 b' def writestate(repo, state):' | |||
|
82 | 82 | ''.join(['%s %s\n' % (state[s][1], s) |
|
83 | 83 | for s in sorted(state)]), '') |
|
84 | 84 | |
|
85 | def submerge(repo, wctx, mctx, actx): | |
|
85 | def submerge(repo, wctx, mctx, actx, overwrite): | |
|
86 | 86 | """delegated from merge.applyupdates: merging of .hgsubstate file |
|
87 | 87 | in working context, merging context and ancestor context""" |
|
88 | 88 | if mctx == actx: # backwards? |
@@ -114,7 +114,7 b' def submerge(repo, wctx, mctx, actx):' | |||
|
114 | 114 | continue |
|
115 | 115 | elif ld == a: # other side changed |
|
116 | 116 | debug(s, "other changed, get", r) |
|
117 | wctx.sub(s).get(r) | |
|
117 | wctx.sub(s).get(r, overwrite) | |
|
118 | 118 | sm[s] = r |
|
119 | 119 | elif ld[0] != r[0]: # sources differ |
|
120 | 120 | if repo.ui.promptchoice( |
@@ -123,11 +123,11 b' def submerge(repo, wctx, mctx, actx):' | |||
|
123 | 123 | % (s, l[0], r[0]), |
|
124 | 124 | (_('&Local'), _('&Remote')), 0): |
|
125 | 125 | debug(s, "prompt changed, get", r) |
|
126 | wctx.sub(s).get(r) | |
|
126 | wctx.sub(s).get(r, overwrite) | |
|
127 | 127 | sm[s] = r |
|
128 | 128 | elif ld[1] == a[1]: # local side is unchanged |
|
129 | 129 | debug(s, "other side changed, get", r) |
|
130 | wctx.sub(s).get(r) | |
|
130 | wctx.sub(s).get(r, overwrite) | |
|
131 | 131 | sm[s] = r |
|
132 | 132 | else: |
|
133 | 133 | debug(s, "both sides changed, merge with", r) |
@@ -260,13 +260,13 b' class abstractsubrepo(object):' | |||
|
260 | 260 | """ |
|
261 | 261 | raise NotImplementedError |
|
262 | 262 | |
|
263 | def get(self, state): | |
|
263 | def get(self, state, overwrite=False): | |
|
264 | 264 | """run whatever commands are needed to put the subrepo into |
|
265 | 265 | this state |
|
266 | 266 | """ |
|
267 | 267 | raise NotImplementedError |
|
268 | 268 | |
|
269 | def merge(self, state): | |
|
269 | def merge(self, state, overwrite=False): | |
|
270 | 270 | """merge currently-saved state with the new state.""" |
|
271 | 271 | raise NotImplementedError |
|
272 | 272 | |
@@ -419,7 +419,7 b' class hgsubrepo(abstractsubrepo):' | |||
|
419 | 419 | other = hg.repository(self._repo.ui, srcurl) |
|
420 | 420 | self._repo.pull(other) |
|
421 | 421 | |
|
422 | def get(self, state): | |
|
422 | def get(self, state, overwrite=False): | |
|
423 | 423 | self._get(state) |
|
424 | 424 | source, revision, kind = state |
|
425 | 425 | self._repo.ui.debug("getting subrepo %s\n" % self._path) |
@@ -589,7 +589,9 b' class svnsubrepo(abstractsubrepo):' | |||
|
589 | 589 | except OSError: |
|
590 | 590 | pass |
|
591 | 591 | |
|
592 | def get(self, state): | |
|
592 | def get(self, state, overwrite=False): | |
|
593 | if overwrite: | |
|
594 | self._svncommand(['revert', '--recursive', self._path]) | |
|
593 | 595 | status = self._svncommand(['checkout', state[0], '--revision', state[1]]) |
|
594 | 596 | if not re.search('Checked out revision [0-9]+.', status): |
|
595 | 597 | raise util.Abort(status.splitlines()[-1]) |
@@ -264,3 +264,35 b' update to nullrev (must delete the subre' | |||
|
264 | 264 | $ hg up null |
|
265 | 265 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
266 | 266 | $ ls |
|
267 | ||
|
268 | Check hg update --clean | |
|
269 | $ cd $TESTTMP/sub/t | |
|
270 | $ cd s | |
|
271 | $ echo c0 > alpha | |
|
272 | $ echo c1 > f1 | |
|
273 | $ echo c1 > f2 | |
|
274 | $ svn add f1 -q | |
|
275 | $ svn status | |
|
276 | ? a | |
|
277 | X externals | |
|
278 | ? f2 | |
|
279 | M alpha | |
|
280 | A f1 | |
|
281 | ||
|
282 | Performing status on external item at 'externals' | |
|
283 | $ cd .. | |
|
284 | $ hg update -C | |
|
285 | ||
|
286 | Fetching external item into '$TESTTMP/sub/t/s/externals' | |
|
287 | Checked out external at revision 1. | |
|
288 | ||
|
289 | Checked out revision 3. | |
|
290 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
291 | $ cd s | |
|
292 | $ svn status | |
|
293 | ? a | |
|
294 | X externals | |
|
295 | ? f1 | |
|
296 | ? f2 | |
|
297 | ||
|
298 | Performing status on external item at 'externals' |
@@ -675,3 +675,31 b' subrepository:' | |||
|
675 | 675 | committing subrepository subrepo-1 |
|
676 | 676 | committing subrepository subrepo-2 |
|
677 | 677 | $ hg st subrepo-2/file |
|
678 | ||
|
679 | Check hg update --clean | |
|
680 | $ cd $TESTTMP/sub/t | |
|
681 | $ rm -r t/t.orig | |
|
682 | $ hg status -S --all | |
|
683 | C .hgsub | |
|
684 | C .hgsubstate | |
|
685 | C a | |
|
686 | C s/.hgsub | |
|
687 | C s/.hgsubstate | |
|
688 | C s/a | |
|
689 | C s/ss/a | |
|
690 | C t/t | |
|
691 | $ echo c1 > s/a | |
|
692 | $ cd s | |
|
693 | $ echo c1 > b | |
|
694 | $ echo c1 > c | |
|
695 | $ hg add b | |
|
696 | $ cd .. | |
|
697 | $ hg status -S | |
|
698 | M s/a | |
|
699 | A s/b | |
|
700 | ? s/c | |
|
701 | $ hg update -C | |
|
702 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
703 | $ hg status -S | |
|
704 | ? s/b | |
|
705 | ? s/c |
General Comments 0
You need to be logged in to leave comments.
Login now