##// END OF EJS Templates
merge: make hg.merge() take a context instead of a node...
Martin von Zweigbergk -
r44916:2f290136 default
parent child Browse files
Show More
@@ -171,11 +171,11 b" def fetch(ui, repo, source=b'default', *"
171 % (repo.changelog.rev(firstparent), short(firstparent))
171 % (repo.changelog.rev(firstparent), short(firstparent))
172 )
172 )
173 hg.clean(repo, firstparent)
173 hg.clean(repo, firstparent)
174 p2ctx = repo[secondparent]
174 ui.status(
175 ui.status(
175 _(b'merging with %d:%s\n')
176 _(b'merging with %d:%s\n') % (p2ctx.rev(), short(secondparent))
176 % (repo.changelog.rev(secondparent), short(secondparent))
177 )
177 )
178 err = hg.merge(repo, secondparent, remind=False)
178 err = hg.merge(p2ctx, remind=False)
179
179
180 if not err:
180 if not err:
181 # we don't translate commit messages
181 # we don't translate commit messages
@@ -858,7 +858,7 b' class queue(object):'
858 strip(self.ui, repo, [n], update=False, backup=False)
858 strip(self.ui, repo, [n], update=False, backup=False)
859
859
860 ctx = repo[rev]
860 ctx = repo[rev]
861 ret = hg.merge(repo, rev)
861 ret = hg.merge(ctx)
862 if ret:
862 if ret:
863 raise error.Abort(_(b"update returned %d") % ret)
863 raise error.Abort(_(b"update returned %d") % ret)
864 n = newcommit(repo, None, ctx.description(), ctx.user(), force=True)
864 n = newcommit(repo, None, ctx.description(), ctx.user(), force=True)
@@ -876,7 +876,7 b' def _dobackout(ui, repo, node=None, rev='
876 )
876 )
877 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
877 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
878 with ui.configoverride(overrides, b'backout'):
878 with ui.configoverride(overrides, b'backout'):
879 return hg.merge(repo, hex(repo.changelog.tip()))
879 return hg.merge(repo[b'tip'])
880 return 0
880 return 0
881
881
882
882
@@ -4878,7 +4878,7 b' def merge(ui, repo, node=None, **opts):'
4878 node = opts.get(b'rev')
4878 node = opts.get(b'rev')
4879
4879
4880 if node:
4880 if node:
4881 node = scmutil.revsingle(repo, node).node()
4881 ctx = scmutil.revsingle(repo, node)
4882 else:
4882 else:
4883 if ui.configbool(b'commands', b'merge.require-rev'):
4883 if ui.configbool(b'commands', b'merge.require-rev'):
4884 raise error.Abort(
4884 raise error.Abort(
@@ -4887,15 +4887,15 b' def merge(ui, repo, node=None, **opts):'
4887 b'with'
4887 b'with'
4888 )
4888 )
4889 )
4889 )
4890 node = repo[destutil.destmerge(repo)].node()
4890 ctx = repo[destutil.destmerge(repo)]
4891
4891
4892 if node is None:
4892 if ctx.node() is None:
4893 raise error.Abort(_(b'merging with the working copy has no effect'))
4893 raise error.Abort(_(b'merging with the working copy has no effect'))
4894
4894
4895 if opts.get(b'preview'):
4895 if opts.get(b'preview'):
4896 # find nodes that are ancestors of p2 but not of p1
4896 # find nodes that are ancestors of p2 but not of p1
4897 p1 = repo[b'.'].node()
4897 p1 = repo[b'.'].node()
4898 p2 = node
4898 p2 = ctx.node()
4899 nodes = repo.changelog.findmissing(common=[p1], heads=[p2])
4899 nodes = repo.changelog.findmissing(common=[p1], heads=[p2])
4900
4900
4901 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
4901 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
@@ -4909,7 +4909,7 b' def merge(ui, repo, node=None, **opts):'
4909 with ui.configoverride(overrides, b'merge'):
4909 with ui.configoverride(overrides, b'merge'):
4910 force = opts.get(b'force')
4910 force = opts.get(b'force')
4911 labels = [b'working copy', b'merge rev']
4911 labels = [b'working copy', b'merge rev']
4912 return hg.merge(repo, node, force=force, labels=labels)
4912 return hg.merge(ctx, force=force, labels=labels)
4913
4913
4914
4914
4915 statemod.addunfinished(
4915 statemod.addunfinished(
@@ -1137,11 +1137,12 b' def updatetotally(ui, repo, checkout, br'
1137
1137
1138
1138
1139 def merge(
1139 def merge(
1140 repo, node, force=False, remind=True, labels=None,
1140 ctx, force=False, remind=True, labels=None,
1141 ):
1141 ):
1142 """Branch merge with node, resolving changes. Return true if any
1142 """Branch merge with node, resolving changes. Return true if any
1143 unresolved conflicts."""
1143 unresolved conflicts."""
1144 stats = mergemod.merge(repo[node], force=force, labels=labels)
1144 repo = ctx.repo()
1145 stats = mergemod.merge(ctx, force=force, labels=labels)
1145 _showstats(repo, stats)
1146 _showstats(repo, stats)
1146 if stats.unresolvedcount:
1147 if stats.unresolvedcount:
1147 repo.ui.status(
1148 repo.ui.status(
@@ -806,7 +806,7 b' class hgsubrepo(abstractsubrepo):'
806 self.ui.debug(
806 self.ui.debug(
807 b'merging subrepository "%s"\n' % subrelpath(self)
807 b'merging subrepository "%s"\n' % subrelpath(self)
808 )
808 )
809 hg.merge(self._repo, state[1], remind=False)
809 hg.merge(dst, remind=False)
810
810
811 wctx = self._repo[None]
811 wctx = self._repo[None]
812 if self.dirty():
812 if self.dirty():
@@ -67,6 +67,9 b''
67 * The deprecated `ui.progress()` has now been deleted. Please use
67 * The deprecated `ui.progress()` has now been deleted. Please use
68 `ui.makeprogress()` instead.
68 `ui.makeprogress()` instead.
69
69
70 * `hg.merge()` now takes a `ctx` instead of the previous `repo` and
71 `node` arguments.
72
70 * `hg.merge()` has lost its `abort` argument. Please call
73 * `hg.merge()` has lost its `abort` argument. Please call
71 `hg.abortmerge()` directly instead.
74 `hg.abortmerge()` directly instead.
72
75
General Comments 0
You need to be logged in to leave comments. Login now