Show More
@@ -2135,7 +2135,8 b' def undo(ui, repo):' | |||
|
2135 | 2135 | """ |
|
2136 | 2136 | repo.undo() |
|
2137 | 2137 | |
|
2138 |
def update(ui, repo, node=None, merge=False, clean=False, |
|
|
2138 | def update(ui, repo, node=None, merge=False, clean=False, force=None, | |
|
2139 | branch=None): | |
|
2139 | 2140 | """update or merge working directory |
|
2140 | 2141 | |
|
2141 | 2142 | Update the working directory to the specified revision. |
@@ -2172,7 +2173,7 b' def update(ui, repo, node=None, merge=Fa' | |||
|
2172 | 2173 | return 1 |
|
2173 | 2174 | else: |
|
2174 | 2175 | node = node and repo.lookup(node) or repo.changelog.tip() |
|
2175 | return repo.update(node, allow=merge, force=clean) | |
|
2176 | return repo.update(node, allow=merge, force=clean, forcemerge=force) | |
|
2176 | 2177 | |
|
2177 | 2178 | def verify(ui, repo): |
|
2178 | 2179 | """verify the integrity of the repository |
@@ -2418,8 +2419,9 b' table = {' | |||
|
2418 | 2419 | (update, |
|
2419 | 2420 | [('b', 'branch', "", _('checkout the head of a specific branch')), |
|
2420 | 2421 | ('m', 'merge', None, _('allow merging of branches')), |
|
2421 |
('C', 'clean', None, _('overwrite locally modified files')) |
|
|
2422 | _('hg update [-b TAG] [-m] [-C] [REV]')), | |
|
2422 | ('C', 'clean', None, _('overwrite locally modified files')), | |
|
2423 | ('f', 'force', None, _('force a merge with outstanding changes'))], | |
|
2424 | _('hg update [-b TAG] [-m] [-C] [-f] [REV]')), | |
|
2423 | 2425 | "verify": (verify, [], _('hg verify')), |
|
2424 | 2426 | "version": (show_version, [], _('hg version')), |
|
2425 | 2427 | } |
@@ -1358,7 +1358,7 b' class localrepository(object):' | |||
|
1358 | 1358 | return |
|
1359 | 1359 | |
|
1360 | 1360 | def update(self, node, allow=False, force=False, choose=None, |
|
1361 | moddirstate=True): | |
|
1361 | moddirstate=True, forcemerge=False): | |
|
1362 | 1362 | pl = self.dirstate.parents() |
|
1363 | 1363 | if not force and pl[1] != nullid: |
|
1364 | 1364 | self.ui.warn(_("aborting: outstanding uncommitted merges\n")) |
@@ -1378,6 +1378,18 b' class localrepository(object):' | |||
|
1378 | 1378 | |
|
1379 | 1379 | (c, a, d, u) = self.changes() |
|
1380 | 1380 | |
|
1381 | if allow and not forcemerge: | |
|
1382 | if c or a or d: | |
|
1383 | raise util.Abort(_("outstanding uncommited changes")) | |
|
1384 | if not forcemerge and not force: | |
|
1385 | for f in u: | |
|
1386 | if f in m2: | |
|
1387 | t1 = self.wread(f) | |
|
1388 | t2 = self.file(f).read(m2[f]) | |
|
1389 | if cmp(t1, t2) != 0: | |
|
1390 | raise util.Abort(_("'%s' already exists in the working" | |
|
1391 | " dir and differs from remote") % f) | |
|
1392 | ||
|
1381 | 1393 | # is this a jump, or a merge? i.e. is there a linear path |
|
1382 | 1394 | # from p1 to p2? |
|
1383 | 1395 | linear_path = (pa == p1 or pa == p2) |
@@ -40,8 +40,10 b' echo This is file c1 > c' | |||
|
40 | 40 | hg add c |
|
41 | 41 | hg commit -m "commit #2" -d "0 0" |
|
42 | 42 | echo This is file b2 > b |
|
43 | echo %% merge should fail | |
|
44 | env HGMERGE=../merge hg update -m 1 | |
|
43 | 45 | echo %% merge of b expected |
|
44 | env HGMERGE=../merge hg update -m 1 | |
|
46 | env HGMERGE=../merge hg update -f -m 1 | |
|
45 | 47 | cd ..; /bin/rm -rf t |
|
46 | 48 | echo %% |
|
47 | 49 | |
@@ -65,8 +67,10 b' echo \'Contents of b should be "this is f' | |||
|
65 | 67 | cat b |
|
66 | 68 | |
|
67 | 69 | echo This is file b22 > b |
|
70 | echo %% merge fails | |
|
71 | env HGMERGE=../merge hg update -m 2 | |
|
68 | 72 | echo %% merge expected! |
|
69 | env HGMERGE=../merge hg update -m 2 | |
|
73 | env HGMERGE=../merge hg update -f -m 2 | |
|
70 | 74 | cd ..; /bin/rm -rf t |
|
71 | 75 | |
|
72 | 76 | mkdir t |
@@ -85,6 +89,8 b' echo This is file c1 > c' | |||
|
85 | 89 | hg add c |
|
86 | 90 | hg commit -m "commit #3" -d "0 0" |
|
87 | 91 | echo This is file b33 > b |
|
88 |
echo %% merge of b |
|
|
92 | echo %% merge of b should fail | |
|
89 | 93 | env HGMERGE=../merge hg update -m 2 |
|
94 | echo %% merge of b expected | |
|
95 | env HGMERGE=../merge hg update -f -m 2 | |
|
90 | 96 | cd ..; /bin/rm -rf t |
@@ -1,13 +1,19 b'' | |||
|
1 | 1 | %% no merges expected |
|
2 | %% merge should fail | |
|
3 | abort: 'b' already exists in the working dir and differs from remote | |
|
2 | 4 | %% merge of b expected |
|
3 | 5 | merging for b |
|
4 | 6 | merging b |
|
5 | 7 | %% |
|
6 | 8 | Contents of b should be "this is file b1" |
|
7 | 9 | This is file b1 |
|
10 | %% merge fails | |
|
11 | abort: outstanding uncommited changes | |
|
8 | 12 | %% merge expected! |
|
9 | 13 | merging for b |
|
10 | 14 | merging b |
|
15 | %% merge of b should fail | |
|
16 | abort: outstanding uncommited changes | |
|
11 | 17 | %% merge of b expected |
|
12 | 18 | merging for b |
|
13 | 19 | merging b |
@@ -25,7 +25,8 b' cd ../r2' | |||
|
25 | 25 | hg -q pull ../r1 |
|
26 | 26 | hg status |
|
27 | 27 | hg --debug up |
|
28 | hg --debug up -m | |
|
28 | hg --debug up -m || echo failed | |
|
29 | hg --debug up -f -m | |
|
29 | 30 | hg parents |
|
30 | 31 | hg -v history |
|
31 | 32 | hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
@@ -16,6 +16,8 b' getting b' | |||
|
16 | 16 | merging a |
|
17 | 17 | resolving a |
|
18 | 18 | file a: my b789fdd96dc2 other d730145abbf9 ancestor b789fdd96dc2 |
|
19 | abort: outstanding uncommited changes | |
|
20 | failed | |
|
19 | 21 | resolving manifests |
|
20 | 22 | force None allow 1 moddirstate True linear True |
|
21 | 23 | ancestor 1165e8bd193e local 1165e8bd193e remote 1165e8bd193e |
General Comments 0
You need to be logged in to leave comments.
Login now