Show More
@@ -249,7 +249,7 b' def manifestmerge(repo, p1, p2, pa, over' | |||||
249 | def actionkey(a): |
|
249 | def actionkey(a): | |
250 | return a[1] == 'r' and -1 or 0, a |
|
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 | """apply the merge action list to the working directory |
|
253 | """apply the merge action list to the working directory | |
254 |
|
254 | |||
255 | wctx is the working copy context |
|
255 | wctx is the working copy context | |
@@ -307,7 +307,7 b' def applyupdates(repo, action, wctx, mct' | |||||
307 | repo.ui.note(_("removing %s\n") % f) |
|
307 | repo.ui.note(_("removing %s\n") % f) | |
308 | audit_path(f) |
|
308 | audit_path(f) | |
309 | if f == '.hgsubstate': # subrepo states need updating |
|
309 | if f == '.hgsubstate': # subrepo states need updating | |
310 | subrepo.submerge(repo, wctx, mctx, wctx) |
|
310 | subrepo.submerge(repo, wctx, mctx, wctx, overwrite) | |
311 | try: |
|
311 | try: | |
312 | util.unlink(repo.wjoin(f)) |
|
312 | util.unlink(repo.wjoin(f)) | |
313 | except OSError, inst: |
|
313 | except OSError, inst: | |
@@ -317,7 +317,7 b' def applyupdates(repo, action, wctx, mct' | |||||
317 | removed += 1 |
|
317 | removed += 1 | |
318 | elif m == "m": # merge |
|
318 | elif m == "m": # merge | |
319 | if f == '.hgsubstate': # subrepo states need updating |
|
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 | continue |
|
321 | continue | |
322 | f2, fd, flags, move = a[2:] |
|
322 | f2, fd, flags, move = a[2:] | |
323 | r = ms.resolve(fd, wctx, mctx) |
|
323 | r = ms.resolve(fd, wctx, mctx) | |
@@ -340,7 +340,7 b' def applyupdates(repo, action, wctx, mct' | |||||
340 | t = None |
|
340 | t = None | |
341 | updated += 1 |
|
341 | updated += 1 | |
342 | if f == '.hgsubstate': # subrepo states need updating |
|
342 | if f == '.hgsubstate': # subrepo states need updating | |
343 | subrepo.submerge(repo, wctx, mctx, wctx) |
|
343 | subrepo.submerge(repo, wctx, mctx, wctx, overwrite) | |
344 | elif m == "d": # directory rename |
|
344 | elif m == "d": # directory rename | |
345 | f2, fd, flags = a[2:] |
|
345 | f2, fd, flags = a[2:] | |
346 | if f: |
|
346 | if f: | |
@@ -529,7 +529,7 b' def update(repo, node, branchmerge, forc' | |||||
529 | if not partial: |
|
529 | if not partial: | |
530 | repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) |
|
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 | if not partial: |
|
534 | if not partial: | |
535 | repo.dirstate.setparents(fp1, fp2) |
|
535 | repo.dirstate.setparents(fp1, fp2) |
@@ -82,7 +82,7 b' def writestate(repo, state):' | |||||
82 | ''.join(['%s %s\n' % (state[s][1], s) |
|
82 | ''.join(['%s %s\n' % (state[s][1], s) | |
83 | for s in sorted(state)]), '') |
|
83 | for s in sorted(state)]), '') | |
84 |
|
84 | |||
85 | def submerge(repo, wctx, mctx, actx): |
|
85 | def submerge(repo, wctx, mctx, actx, overwrite): | |
86 | """delegated from merge.applyupdates: merging of .hgsubstate file |
|
86 | """delegated from merge.applyupdates: merging of .hgsubstate file | |
87 | in working context, merging context and ancestor context""" |
|
87 | in working context, merging context and ancestor context""" | |
88 | if mctx == actx: # backwards? |
|
88 | if mctx == actx: # backwards? | |
@@ -114,7 +114,7 b' def submerge(repo, wctx, mctx, actx):' | |||||
114 | continue |
|
114 | continue | |
115 | elif ld == a: # other side changed |
|
115 | elif ld == a: # other side changed | |
116 | debug(s, "other changed, get", r) |
|
116 | debug(s, "other changed, get", r) | |
117 | wctx.sub(s).get(r) |
|
117 | wctx.sub(s).get(r, overwrite) | |
118 | sm[s] = r |
|
118 | sm[s] = r | |
119 | elif ld[0] != r[0]: # sources differ |
|
119 | elif ld[0] != r[0]: # sources differ | |
120 | if repo.ui.promptchoice( |
|
120 | if repo.ui.promptchoice( | |
@@ -123,11 +123,11 b' def submerge(repo, wctx, mctx, actx):' | |||||
123 | % (s, l[0], r[0]), |
|
123 | % (s, l[0], r[0]), | |
124 | (_('&Local'), _('&Remote')), 0): |
|
124 | (_('&Local'), _('&Remote')), 0): | |
125 | debug(s, "prompt changed, get", r) |
|
125 | debug(s, "prompt changed, get", r) | |
126 | wctx.sub(s).get(r) |
|
126 | wctx.sub(s).get(r, overwrite) | |
127 | sm[s] = r |
|
127 | sm[s] = r | |
128 | elif ld[1] == a[1]: # local side is unchanged |
|
128 | elif ld[1] == a[1]: # local side is unchanged | |
129 | debug(s, "other side changed, get", r) |
|
129 | debug(s, "other side changed, get", r) | |
130 | wctx.sub(s).get(r) |
|
130 | wctx.sub(s).get(r, overwrite) | |
131 | sm[s] = r |
|
131 | sm[s] = r | |
132 | else: |
|
132 | else: | |
133 | debug(s, "both sides changed, merge with", r) |
|
133 | debug(s, "both sides changed, merge with", r) | |
@@ -260,13 +260,13 b' class abstractsubrepo(object):' | |||||
260 | """ |
|
260 | """ | |
261 | raise NotImplementedError |
|
261 | raise NotImplementedError | |
262 |
|
262 | |||
263 | def get(self, state): |
|
263 | def get(self, state, overwrite=False): | |
264 | """run whatever commands are needed to put the subrepo into |
|
264 | """run whatever commands are needed to put the subrepo into | |
265 | this state |
|
265 | this state | |
266 | """ |
|
266 | """ | |
267 | raise NotImplementedError |
|
267 | raise NotImplementedError | |
268 |
|
268 | |||
269 | def merge(self, state): |
|
269 | def merge(self, state, overwrite=False): | |
270 | """merge currently-saved state with the new state.""" |
|
270 | """merge currently-saved state with the new state.""" | |
271 | raise NotImplementedError |
|
271 | raise NotImplementedError | |
272 |
|
272 | |||
@@ -419,7 +419,7 b' class hgsubrepo(abstractsubrepo):' | |||||
419 | other = hg.repository(self._repo.ui, srcurl) |
|
419 | other = hg.repository(self._repo.ui, srcurl) | |
420 | self._repo.pull(other) |
|
420 | self._repo.pull(other) | |
421 |
|
421 | |||
422 | def get(self, state): |
|
422 | def get(self, state, overwrite=False): | |
423 | self._get(state) |
|
423 | self._get(state) | |
424 | source, revision, kind = state |
|
424 | source, revision, kind = state | |
425 | self._repo.ui.debug("getting subrepo %s\n" % self._path) |
|
425 | self._repo.ui.debug("getting subrepo %s\n" % self._path) | |
@@ -589,7 +589,9 b' class svnsubrepo(abstractsubrepo):' | |||||
589 | except OSError: |
|
589 | except OSError: | |
590 | pass |
|
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 | status = self._svncommand(['checkout', state[0], '--revision', state[1]]) |
|
595 | status = self._svncommand(['checkout', state[0], '--revision', state[1]]) | |
594 | if not re.search('Checked out revision [0-9]+.', status): |
|
596 | if not re.search('Checked out revision [0-9]+.', status): | |
595 | raise util.Abort(status.splitlines()[-1]) |
|
597 | raise util.Abort(status.splitlines()[-1]) |
@@ -264,3 +264,35 b' update to nullrev (must delete the subre' | |||||
264 | $ hg up null |
|
264 | $ hg up null | |
265 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
265 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
266 | $ ls |
|
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 | committing subrepository subrepo-1 |
|
675 | committing subrepository subrepo-1 | |
676 | committing subrepository subrepo-2 |
|
676 | committing subrepository subrepo-2 | |
677 | $ hg st subrepo-2/file |
|
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