Show More
@@ -24,19 +24,19 b" def fetch(ui, repo, source='default', **" | |||||
24 | if modheads == 0: |
|
24 | if modheads == 0: | |
25 | return 0 |
|
25 | return 0 | |
26 | if modheads == 1: |
|
26 | if modheads == 1: | |
27 |
return |
|
27 | return hg.update(repo, repo.changelog.tip()) | |
28 | newheads = repo.heads(parent) |
|
28 | newheads = repo.heads(parent) | |
29 | newchildren = [n for n in repo.heads(parent) if n != parent] |
|
29 | newchildren = [n for n in repo.heads(parent) if n != parent] | |
30 | newparent = parent |
|
30 | newparent = parent | |
31 | if newchildren: |
|
31 | if newchildren: | |
32 |
|
|
32 | hg.update(repo, newchildren[0]) | |
33 | newparent = newchildren[0] |
|
33 | newparent = newchildren[0] | |
34 | newheads = [n for n in repo.heads() if n != newparent] |
|
34 | newheads = [n for n in repo.heads() if n != newparent] | |
35 | err = False |
|
35 | err = False | |
36 | if newheads: |
|
36 | if newheads: | |
37 | ui.status(_('merging with new head %d:%s\n') % |
|
37 | ui.status(_('merging with new head %d:%s\n') % | |
38 | (repo.changelog.rev(newheads[0]), short(newheads[0]))) |
|
38 | (repo.changelog.rev(newheads[0]), short(newheads[0]))) | |
39 |
err = hg. |
|
39 | err = hg.merge(repo, newheads[0], remind=False) | |
40 | if not err and len(newheads) > 1: |
|
40 | if not err and len(newheads) > 1: | |
41 | ui.status(_('not merging with %d other new heads ' |
|
41 | ui.status(_('not merging with %d other new heads ' | |
42 | '(use "hg heads" and "hg merge" to merge them)') % |
|
42 | '(use "hg heads" and "hg merge" to merge them)') % |
@@ -197,7 +197,7 b' class bisect(object):' | |||||
197 | check_clean(self.ui, self.repo) |
|
197 | check_clean(self.ui, self.repo) | |
198 | rev = self.next() |
|
198 | rev = self.next() | |
199 | if rev is not None: |
|
199 | if rev is not None: | |
200 |
return hg. |
|
200 | return hg.clean(self.repo, rev) | |
201 |
|
201 | |||
202 | def good(self, rev): |
|
202 | def good(self, rev): | |
203 | self.goodrevs.append(rev) |
|
203 | self.goodrevs.append(rev) |
@@ -190,11 +190,11 b' class queue:' | |||||
190 | self.ui.warn("patch didn't work out, merging %s\n" % patch) |
|
190 | self.ui.warn("patch didn't work out, merging %s\n" % patch) | |
191 |
|
191 | |||
192 | # apply failed, strip away that rev and merge. |
|
192 | # apply failed, strip away that rev and merge. | |
193 |
hg. |
|
193 | hg.clean(repo, head, wlock=wlock) | |
194 | self.strip(repo, n, update=False, backup='strip', wlock=wlock) |
|
194 | self.strip(repo, n, update=False, backup='strip', wlock=wlock) | |
195 |
|
195 | |||
196 | c = repo.changelog.read(rev) |
|
196 | c = repo.changelog.read(rev) | |
197 |
ret = hg. |
|
197 | ret = hg.merge(repo, rev, wlock=wlock) | |
198 | if ret: |
|
198 | if ret: | |
199 | raise util.Abort(_("update returned %d") % ret) |
|
199 | raise util.Abort(_("update returned %d") % ret) | |
200 | n = repo.commit(None, c[4], c[1], force=1, wlock=wlock) |
|
200 | n = repo.commit(None, c[4], c[1], force=1, wlock=wlock) | |
@@ -530,7 +530,7 b' class queue:' | |||||
530 | if c or a or d or r: |
|
530 | if c or a or d or r: | |
531 | raise util.Abort(_("local changes found")) |
|
531 | raise util.Abort(_("local changes found")) | |
532 | urev = self.qparents(repo, rev) |
|
532 | urev = self.qparents(repo, rev) | |
533 |
hg. |
|
533 | hg.clean(repo, urev, wlock=wlock) | |
534 | repo.dirstate.write() |
|
534 | repo.dirstate.write() | |
535 |
|
535 | |||
536 | # save is a list of all the branches we are truncating away |
|
536 | # save is a list of all the branches we are truncating away | |
@@ -1019,7 +1019,7 b' class queue:' | |||||
1019 | if not r: |
|
1019 | if not r: | |
1020 | self.ui.warn("Unable to load queue repository\n") |
|
1020 | self.ui.warn("Unable to load queue repository\n") | |
1021 | return 1 |
|
1021 | return 1 | |
1022 |
hg. |
|
1022 | hg.clean(r, qpp[0]) | |
1023 |
|
1023 | |||
1024 | def save(self, repo, msg=None): |
|
1024 | def save(self, repo, msg=None): | |
1025 | if len(self.applied) == 0: |
|
1025 | if len(self.applied) == 0: |
@@ -976,7 +976,7 b' def backout(ui, repo, rev, **opts):' | |||||
976 | if opts['parent']: |
|
976 | if opts['parent']: | |
977 | raise util.Abort(_('cannot use --parent on non-merge changeset')) |
|
977 | raise util.Abort(_('cannot use --parent on non-merge changeset')) | |
978 | parent = p1 |
|
978 | parent = p1 | |
979 |
hg. |
|
979 | hg.clean(repo, node, show_stats=False) | |
980 | revert_opts = opts.copy() |
|
980 | revert_opts = opts.copy() | |
981 | revert_opts['rev'] = hex(parent) |
|
981 | revert_opts['rev'] = hex(parent) | |
982 | revert(ui, repo, **revert_opts) |
|
982 | revert(ui, repo, **revert_opts) | |
@@ -994,7 +994,7 b' def backout(ui, repo, rev, **opts):' | |||||
994 | if opts['merge']: |
|
994 | if opts['merge']: | |
995 | ui.status(_('merging with changeset %s\n') % nice(op1)) |
|
995 | ui.status(_('merging with changeset %s\n') % nice(op1)) | |
996 | n = _lookup(repo, hex(op1)) |
|
996 | n = _lookup(repo, hex(op1)) | |
997 |
hg. |
|
997 | hg.merge(repo, n) | |
998 | else: |
|
998 | else: | |
999 | ui.status(_('the backout changeset is a new head - ' |
|
999 | ui.status(_('the backout changeset is a new head - ' | |
1000 | 'do not forget to merge\n')) |
|
1000 | 'do not forget to merge\n')) | |
@@ -2163,7 +2163,7 b' def merge(ui, repo, node=None, force=Non' | |||||
2163 | """ |
|
2163 | """ | |
2164 |
|
2164 | |||
2165 | node = _lookup(repo, node, branch) |
|
2165 | node = _lookup(repo, node, branch) | |
2166 |
hg. |
|
2166 | return hg.merge(repo, node, force=force) | |
2167 |
|
2167 | |||
2168 | def outgoing(ui, repo, dest=None, **opts): |
|
2168 | def outgoing(ui, repo, dest=None, **opts): | |
2169 | """show changesets not found in destination |
|
2169 | """show changesets not found in destination | |
@@ -2606,8 +2606,7 b' def revert(ui, repo, *pats, **opts):' | |||||
2606 |
|
2606 | |||
2607 | if not opts.get('dry_run'): |
|
2607 | if not opts.get('dry_run'): | |
2608 | repo.dirstate.forget(forget[0]) |
|
2608 | repo.dirstate.forget(forget[0]) | |
2609 |
r = hg. |
|
2609 | r = hg.revert(repo, node, update.has_key) | |
2610 | wlock=wlock, show_stats=False) # revert |
|
|||
2611 | repo.dirstate.update(add[0], 'a') |
|
2610 | repo.dirstate.update(add[0], 'a') | |
2612 | repo.dirstate.update(undelete[0], 'n') |
|
2611 | repo.dirstate.update(undelete[0], 'n') | |
2613 | repo.dirstate.update(remove[0], 'r') |
|
2612 | repo.dirstate.update(remove[0], 'r') | |
@@ -2905,11 +2904,15 b' def update(ui, repo, node=None, merge=Fa' | |||||
2905 | By default, update will refuse to run if doing so would require |
|
2904 | By default, update will refuse to run if doing so would require | |
2906 | merging or discarding local changes. |
|
2905 | merging or discarding local changes. | |
2907 | """ |
|
2906 | """ | |
|
2907 | node = _lookup(repo, node, branch) | |||
2908 | if merge: |
|
2908 | if merge: | |
2909 | ui.warn(_('(the -m/--merge option is deprecated; ' |
|
2909 | ui.warn(_('(the -m/--merge option is deprecated; ' | |
2910 | 'use the merge command instead)\n')) |
|
2910 | 'use the merge command instead)\n')) | |
2911 | node = _lookup(repo, node, branch) |
|
2911 | return hg.merge(repo, node, force=force) | |
2912 | return hg.update(repo, node, allow=merge, force=clean, forcemerge=force) |
|
2912 | elif clean: | |
|
2913 | return hg.clean(repo, node) | |||
|
2914 | else: | |||
|
2915 | return hg.update(repo, node) | |||
2913 |
|
2916 | |||
2914 | def _lookup(repo, node, branch=None): |
|
2917 | def _lookup(repo, node, branch=None): | |
2915 | if branch: |
|
2918 | if branch: |
@@ -10,7 +10,7 b' from repo import *' | |||||
10 | from demandload import * |
|
10 | from demandload import * | |
11 | from i18n import gettext as _ |
|
11 | from i18n import gettext as _ | |
12 | demandload(globals(), "localrepo bundlerepo httprepo sshrepo statichttprepo") |
|
12 | demandload(globals(), "localrepo bundlerepo httprepo sshrepo statichttprepo") | |
13 | demandload(globals(), "errno lock os shutil util merge") |
|
13 | demandload(globals(), "errno lock os shutil util merge@_merge") | |
14 |
|
14 | |||
15 | def _local(path): |
|
15 | def _local(path): | |
16 | return (os.path.isfile(path and util.drop_scheme('file', path)) and |
|
16 | return (os.path.isfile(path and util.drop_scheme('file', path)) and | |
@@ -200,20 +200,30 b' def clone(ui, source, dest=None, pull=Fa' | |||||
200 | dest_lock.release() |
|
200 | dest_lock.release() | |
201 |
|
201 | |||
202 | if update: |
|
202 | if update: | |
203 | merge.update(dest_repo, dest_repo.changelog.tip()) |
|
203 | _merge.update(dest_repo, dest_repo.changelog.tip()) | |
204 | if dir_cleanup: |
|
204 | if dir_cleanup: | |
205 | dir_cleanup.close() |
|
205 | dir_cleanup.close() | |
206 |
|
206 | |||
207 | return src_repo, dest_repo |
|
207 | return src_repo, dest_repo | |
208 |
|
208 | |||
|
209 | def update(repo, node): | |||
|
210 | """update the working directory to node, merging linear changes""" | |||
|
211 | return _merge.update(repo, node) | |||
209 |
|
212 | |||
210 | # This should instead be several functions with short arglists, like |
|
213 | def clean(repo, node, wlock=None, show_stats=True): | |
211 | # update/merge/revert |
|
214 | """forcibly switch the working directory to node, clobbering changes""" | |
|
215 | return _merge.update(repo, node, force=True, wlock=wlock, | |||
|
216 | show_stats=show_stats) | |||
212 |
|
217 | |||
213 | def update(repo, node, allow=False, force=False, choose=None, |
|
218 | def merge(repo, node, force=None, remind=True, wlock=None): | |
214 | moddirstate=True, forcemerge=False, wlock=None, show_stats=True): |
|
219 | """branch merge with node, resolving changes""" | |
215 |
return merge.update(repo, node, allow, force, |
|
220 | return _merge.update(repo, node, allow=True, forcemerge=force, | |
216 |
|
|
221 | remind=remind, wlock=wlock) | |
|
222 | ||||
|
223 | def revert(repo, node, choose): | |||
|
224 | """revert changes to revision in node without updating dirstate""" | |||
|
225 | return _merge.update(repo, node, force=True, choose=choose, | |||
|
226 | moddirstate=False, show_stats=False) | |||
217 |
|
227 | |||
218 | def verify(repo): |
|
228 | def verify(repo): | |
219 | """verify the consistency of a repository""" |
|
229 | """verify the consistency of a repository""" |
@@ -17,7 +17,7 b' date: Mon Jan 12 13:46:40 1970 +0' | |||||
17 | summary: 1 |
|
17 | summary: 1 | |
18 |
|
18 | |||
19 | resolving manifests |
|
19 | resolving manifests | |
20 |
force |
|
20 | force False allow False moddirstate True linear True | |
21 | ancestor a0c8bcbbb45c local a0c8bcbbb45c remote 1165e8bd193e |
|
21 | ancestor a0c8bcbbb45c local a0c8bcbbb45c remote 1165e8bd193e | |
22 | a versions differ, resolve |
|
22 | a versions differ, resolve | |
23 | remote created b |
|
23 | remote created b | |
@@ -33,7 +33,7 b' date: Mon Jan 12 13:46:40 1970 +0' | |||||
33 | summary: 2 |
|
33 | summary: 2 | |
34 |
|
34 | |||
35 | resolving manifests |
|
35 | resolving manifests | |
36 |
force |
|
36 | force False allow False moddirstate True linear True | |
37 | ancestor a0c8bcbbb45c local 1165e8bd193e remote a0c8bcbbb45c |
|
37 | ancestor a0c8bcbbb45c local 1165e8bd193e remote a0c8bcbbb45c | |
38 | remote deleted b |
|
38 | remote deleted b | |
39 | removing b |
|
39 | removing b | |
@@ -51,7 +51,7 b' date: Mon Jan 12 13:46:40 1970 +0' | |||||
51 | summary: 1 |
|
51 | summary: 1 | |
52 |
|
52 | |||
53 | resolving manifests |
|
53 | resolving manifests | |
54 |
force |
|
54 | force False allow False moddirstate True linear True | |
55 | ancestor a0c8bcbbb45c local a0c8bcbbb45c remote 1165e8bd193e |
|
55 | ancestor a0c8bcbbb45c local a0c8bcbbb45c remote 1165e8bd193e | |
56 | a versions differ, resolve |
|
56 | a versions differ, resolve | |
57 | remote created b |
|
57 | remote created b | |
@@ -99,7 +99,7 b' date: Mon Jan 12 13:46:40 1970 +0' | |||||
99 | summary: 2 |
|
99 | summary: 2 | |
100 |
|
100 | |||
101 | resolving manifests |
|
101 | resolving manifests | |
102 |
force |
|
102 | force False allow False moddirstate True linear False | |
103 | ancestor a0c8bcbbb45c local 1165e8bd193e remote 4096f2872392 |
|
103 | ancestor a0c8bcbbb45c local 1165e8bd193e remote 4096f2872392 | |
104 | a versions differ, resolve |
|
104 | a versions differ, resolve | |
105 | b versions differ, resolve |
|
105 | b versions differ, resolve |
@@ -40,7 +40,7 b' a' | |||||
40 | side1 |
|
40 | side1 | |
41 | side2 |
|
41 | side2 | |
42 | resolving manifests |
|
42 | resolving manifests | |
43 |
force |
|
43 | force True allow False moddirstate True linear False | |
44 | ancestor 8515d4bfda76 local 1c0f48f8ece6 remote 0594b9004bae |
|
44 | ancestor 8515d4bfda76 local 1c0f48f8ece6 remote 0594b9004bae | |
45 | remote deleted side2, clobbering |
|
45 | remote deleted side2, clobbering | |
46 | remote deleted side1, clobbering |
|
46 | remote deleted side1, clobbering |
General Comments 0
You need to be logged in to leave comments.
Login now