mercurial@45514: new changeset
New changeset in mercurial: https://www.mercurial-scm.org/repo/hg/rev/93a0f3ba36bb changeset: 45514:93a0f3ba36bb bookmark:@ tag: tip parent: 45513:22140fd783d2 parent: 45509:2bc978921e8a user:Augie Fackler date:Mon Sep 21 15:05:38 2020 -0400 summary: merge with stable -- Repository URL: https://www.mercurial-scm.org/repo/hg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9063: merge: use merge.clean_update() when applicable
martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY We have had this higher-level function (higher than `merge.update()`, that is) for a while. Let's simply some callers by using it. I don't know why I didn't do this when I introduced the function. After this patch, there are no remaining callers that pass `hg.updaterepo()` with `overwrite=True`. We'll clean that up soon. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9063 AFFECTED FILES hgext/rebase.py hgext/transplant.py mercurial/cmdutil.py mercurial/commands.py mercurial/hg.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -25,6 +25,7 @@ exchange, logcmdutil, match as matchmod, +merge as merge, node, pathutil, phases, @@ -783,7 +784,10 @@ % (revision[0:12], self._path) ) repo = urepo -hg.updaterepo(repo, revision, overwrite) +if overwrite: +merge.clean_update(repo[revision]) +else: +hg.updaterepo(repo, revision, False) @annotatesubrepoerror def merge(self, state): diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -1074,7 +1074,7 @@ def clean(repo, node, show_stats=True, quietempty=False): """forcibly switch the working directory to node, clobbering changes""" -stats = updaterepo(repo, node, True) +stats = mergemod.clean_update(repo[node]) assert stats.unresolvedcount == 0 if show_stats: _showstats(repo, stats, quietempty) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3253,7 +3253,7 @@ if not graftstate.exists(): raise error.Abort(_(b"no interrupted graft found")) pctx = repo[b'.'] -hg.updaterepo(repo, pctx.node(), overwrite=True) +mergemod.clean_update(pctx) graftstate.delete() ui.status(_(b"stopped the interrupted graft\n")) ui.status(_(b"working directory is now at %s\n") % pctx.hex()[:12]) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -4183,7 +4183,7 @@ if cleanup: with repo.wlock(), repo.lock(): -hg.updaterepo(repo, startctx.node(), overwrite=True) +mergemod.clean_update(startctx) # stripping the new nodes created strippoints = [ c.node() for c in repo.set(b"roots(%ld)", newnodes) @@ -4193,7 +4193,7 @@ if not cleanup: # we don't update to the startnode if we can't strip startctx = repo[b'.'] -hg.updaterepo(repo, startctx.node(), overwrite=True) +mergemod.clean_update(startctx) ui.status(_(b"graft aborted\n")) ui.status(_(b"working directory is now at %s\n") % startctx.hex()[:12]) diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -476,7 +476,7 @@ """logic to stop an interrupted transplant""" if self.canresume(): startctx = repo[b'.'] -hg.updaterepo(repo, startctx.node(), overwrite=True) +merge.clean_update(startctx) ui.status(_(b"stopped the interrupted transplant\n")) ui.status( _(b"working directory is now at %s\n") % startctx.hex()[:12] diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1071,7 +1071,7 @@ ) # update to the current working revision # to clear interrupted merge -hg.updaterepo(repo, rbsrt.originalwd, overwrite=True) +mergemod.clean_update(repo[rbsrt.originalwd]) rbsrt._finishrebase() return 0 elif inmemory: To: martinvonz, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9067: merge: delete hg.updaterepo() and use merge.update() instead (API)
martinvonz created this revision. Herald added a reviewer: durin42. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9067 AFFECTED FILES hgext/histedit.py hgext/rebase.py hgext/sparse.py mercurial/hg.py mercurial/shelve.py mercurial/subrepo.py relnotes/next CHANGE DETAILS diff --git a/relnotes/next b/relnotes/next --- a/relnotes/next +++ b/relnotes/next @@ -24,3 +24,6 @@ the higher-level functions available in the same module cover your use cases. + * `hg.updaterepo()` has been deleted. Use `merge.update()` or + `merge.clean_update()` instead. + diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -787,7 +787,7 @@ if overwrite: merge.clean_update(repo[revision]) else: -hg.updaterepo(repo, revision, False) +merge.update(repo[revision]) @annotatesubrepoerror def merge(self, state): diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -839,7 +839,7 @@ state.nodestoremove.append(newnode) shelvectx = repo[newnode] -hg.updaterepo(repo, pendingctx.node(), overwrite=False) +merge.update(pendingctx) mergefiles(ui, repo, state.wctx, shelvectx) restorebranch(ui, repo, state.branchtorestore) @@ -1031,7 +1031,7 @@ ui.status(msg) else: shelvectx = repo[newnode] -hg.updaterepo(repo, tmpwctx.node(), False) +merge.update(tmpwctx) return shelvectx, ispartialunshelve diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -1043,25 +1043,9 @@ ) -def updaterepo(repo, node, overwrite, updatecheck=None): -"""Update the working directory to node. - -When overwrite is set, changes are clobbered, merged else - -returns stats (see pydoc mercurial.merge.applyupdates)""" -return mergemod._update( -repo, -node, -branchmerge=False, -force=overwrite, -labels=[b'working copy', b'destination'], -updatecheck=updatecheck, -) - - def update(repo, node, quietempty=False, updatecheck=None): """update the working directory to node""" -stats = updaterepo(repo, node, False, updatecheck=updatecheck) +stats = mergemod.update(repo[node], updatecheck=updatecheck) _showstats(repo, stats, quietempty) if stats.unresolvedcount: repo.ui.status(_(b"use 'hg resolve' to retry unresolved file merges\n")) diff --git a/hgext/sparse.py b/hgext/sparse.py --- a/hgext/sparse.py +++ b/hgext/sparse.py @@ -80,9 +80,9 @@ dirstate, error, extensions, -hg, logcmdutil, match as matchmod, +merge as mergemod, pycompat, registrar, sparse, @@ -173,9 +173,9 @@ # clone if not narrow_pat and (include or exclude or enableprofile): -def clonesparse(orig, self, node, overwrite, *args, **kwargs): +def clonesparse(orig, ctx, *args, **kwargs): sparse.updateconfig( -self.unfiltered(), +ctx.repo().unfiltered(), pat, {}, include=include, @@ -183,9 +183,9 @@ enableprofile=enableprofile, usereporootpaths=True, ) -return orig(self, node, overwrite, *args, **kwargs) +return orig(ctx, *args, **kwargs) -extensions.wrapfunction(hg, b'updaterepo', clonesparse) +extensions.wrapfunction(mergemod, b'update', clonesparse) return orig(ui, repo, *args, **opts) diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -728,7 +728,7 @@ newwd = self.originalwd if newwd not in [c.rev() for c in repo[None].parents()]: ui.note(_(b"update back to initial working directory parent\n")) -hg.updaterepo(repo, newwd, overwrite=False) +mergemod.update(repo[newwd]) collapsedas = None if self.collapsef and not self.keepf: diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -881,8 +881,7 @@ return False def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges): -parent = ctx.p1().node() -hg.updaterepo(repo, parent, overwrite=False) +mergemod.update(ctx.p1()) ### prepare new commit data commitopts = {} commitopts[b'user'] = ctx.user() @@ -926,7 +925,7 @@ ) if n is None: return ctx, [] -hg.updaterepo(repo, n, overwrite=False) +mergemod.update(repo[n]) replacements = [ (oldctx.node(), (newnode,)), (ctx.node(), (n,)),
D9064: merge: add a back_out() function to encapsulate update()
martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY I've sent several earlier patches adding `merge.clean_update()`, `merge.merge()` etc, one function for each use case. This patch continues that work. I plan to hide the complex `update()` eventually. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9064 AFFECTED FILES mercurial/commands.py mercurial/merge.py CHANGE DETAILS diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -2236,6 +2236,23 @@ return stats +def back_out(ctx, parent=None, wc=None): +if parent is None: +if ctx.p2() is not None: +raise error.ProgrammingError( +b"must specify parent of merge commit to back out" +) +parent = ctx.p1() +return update( +ctx.repo(), +parent, +branchmerge=True, +force=True, +ancestor=ctx.node(), +mergeancestor=False, +) + + def purge( repo, matcher, diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -790,7 +790,8 @@ cmdutil.checkunfinished(repo) cmdutil.bailifchanged(repo) -node = scmutil.revsingle(repo, rev).node() +ctx = scmutil.revsingle(repo, rev) +node = ctx.node() op1, op2 = repo.dirstate.parents() if not repo.changelog.isancestor(node, op1): @@ -821,14 +822,7 @@ with dirstateguard.dirstateguard(repo, b'backout'): overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')} with ui.configoverride(overrides, b'backout'): -stats = mergemod.update( -repo, -parent, -branchmerge=True, -force=True, -ancestor=node, -mergeancestor=False, -) +stats = mergemod.back_out(ctx, parent=repo[parent]) repo.setparents(op1, op2) hg._showstats(repo, stats) if stats.unresolvedcount: To: martinvonz, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9065: merge: make low-level update() private (API)
martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY We have very few callers left that call the low-level `merge.update()` function. I think it's time to make it private. I'll remove the remaining callers in coming patches, except for one call from the `rebase` module. I hope to eventually fix that too, but it's more complex because it requires teaching `merge.graft()` to work with a dirty working copy. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9065 AFFECTED FILES hgext/largefiles/overrides.py hgext/rebase.py hgext/transplant.py mercurial/hg.py mercurial/merge.py relnotes/next CHANGE DETAILS diff --git a/relnotes/next b/relnotes/next --- a/relnotes/next +++ b/relnotes/next @@ -20,3 +20,7 @@ == Internal API Changes == + * `merge.update()` is now private (renamed to `_update()`). Hopefully + the higher-level functions available in the same module cover your + use cases. + diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -1771,7 +1771,7 @@ UPDATECHECK_NO_CONFLICT = b'noconflict' -def update( +def _update( repo, node, branchmerge, @@ -2122,7 +2122,7 @@ force = whether the merge was run with 'merge --force' (deprecated) """ -return update( +return _update( ctx.repo(), ctx.rev(), labels=labels, @@ -2139,7 +2139,7 @@ This involves updating to the commit and discarding any changes in the working copy. """ -return update(ctx.repo(), ctx.rev(), branchmerge=False, force=True, wc=wc) +return _update(ctx.repo(), ctx.rev(), branchmerge=False, force=True, wc=wc) def revert_to(ctx, matcher=None, wc=None): @@ -2149,7 +2149,7 @@ be the same as in the given commit. """ -return update( +return _update( ctx.repo(), ctx.rev(), branchmerge=False, @@ -2200,7 +2200,7 @@ or pctx.rev() == base.rev() ) -stats = update( +stats = _update( repo, ctx.node(), True, @@ -2243,7 +2243,7 @@ b"must specify parent of merge commit to back out" ) parent = ctx.p1() -return update( +return _update( ctx.repo(), parent, branchmerge=True, diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -1049,7 +1049,7 @@ When overwrite is set, changes are clobbered, merged else returns stats (see pydoc mercurial.merge.applyupdates)""" -return mergemod.update( +return mergemod._update( repo, node, branchmerge=False, diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -198,7 +198,7 @@ if pulls: if source != repo: exchange.pull(repo, source.peer(), heads=pulls) -merge.update( +merge._update( repo, pulls[-1], branchmerge=False, force=False ) p1 = repo.dirstate.p1() @@ -275,7 +275,7 @@ tr.close() if pulls: exchange.pull(repo, source.peer(), heads=pulls) -merge.update(repo, pulls[-1], branchmerge=False, force=False) +merge._update(repo, pulls[-1], branchmerge=False, force=False) finally: self.saveseries(revmap, merges) self.transplants.write() diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1497,7 +1497,7 @@ # See explanation in merge.graft() mergeancestor = repo.changelog.isancestor(p1ctx.node(), ctx.node()) -stats = mergemod.update( +stats = mergemod._update( repo, rev, branchmerge=True, diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1699,7 +1699,7 @@ return err -@eh.wrapfunction(merge, b'update') +@eh.wrapfunction(merge, b'_update') def mergeupdate(orig, repo, node, branchmerge, force, *args, **kwargs): matcher = kwargs.get('matcher', None) # note if this is a partial update To: martinvonz, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9066: merge: add a higher-level update() for the common `hg update` use case
martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is different from the `update()` function that I just made private. The new function is specifically for the normal `hg update` use case. It doesn't do a merge and it doesn't do a clean (forced) update. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9066 AFFECTED FILES hgext/transplant.py mercurial/merge.py CHANGE DETAILS diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -2133,6 +2133,23 @@ ) +def update(ctx, updatecheck=None, wc=None): +"""Do a regular update to the given commit, aborting if there are conflicts. + +The 'updatecheck' argument can be used to control what to do in case of +conflicts. +""" +return _update( +ctx.repo(), +ctx.rev(), +branchmerge=False, +force=False, +labels=[b'working copy', b'destination'], +updatecheck=updatecheck, +wc=wc, +) + + def clean_update(ctx, wc=None): """Do a clean update to the given commit. diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -198,9 +198,7 @@ if pulls: if source != repo: exchange.pull(repo, source.peer(), heads=pulls) -merge._update( -repo, pulls[-1], branchmerge=False, force=False -) +merge.update(repo[pulls[-1]]) p1 = repo.dirstate.p1() pulls = [] @@ -275,7 +273,7 @@ tr.close() if pulls: exchange.pull(repo, source.peer(), heads=pulls) -merge._update(repo, pulls[-1], branchmerge=False, force=False) +merge.update(repo[pulls[-1]]) finally: self.saveseries(revmap, merges) self.transplants.write() To: martinvonz, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@45513: 8 new changesets (2 on stable)
8 new changesets (2 on stable) in mercurial: https://www.mercurial-scm.org/repo/hg/rev/1f50bcc96595 changeset: 45506:1f50bcc96595 user:Pierre-Yves David date:Thu Sep 17 11:21:13 2020 +0200 summary: changing-files: document the various sets https://www.mercurial-scm.org/repo/hg/rev/df87821081ee changeset: 45507:df87821081ee user:Pierre-Yves David date:Tue Sep 15 15:03:07 2020 +0200 summary: changing-files: implement equality checking https://www.mercurial-scm.org/repo/hg/rev/27822b8436bf changeset: 45508:27822b8436bf branch: stable parent: 45503:bd5b2b29b82d user:Pierre-Yves David date:Fri Sep 18 12:10:12 2020 +0200 summary: test-strip: display more information highlight buggy behavior https://www.mercurial-scm.org/repo/hg/rev/2bc978921e8a changeset: 45509:2bc978921e8a branch: stable user:Pierre-Yves David date:Fri Sep 18 12:20:28 2020 +0200 summary: strip: with --keep, consider all revs "removed" from the wcp (issue6270) https://www.mercurial-scm.org/repo/hg/rev/1f5c548f15e5 changeset: 45510:1f5c548f15e5 parent: 45507:df87821081ee user:Martin von Zweigbergk date:Fri Sep 18 10:04:02 2020 -0700 summary: rebase: fix an inconsistent hyphenation in a debug message https://www.mercurial-scm.org/repo/hg/rev/e29cd888fd17 changeset: 45511:e29cd888fd17 user:Martin von Zweigbergk date:Fri Sep 18 10:15:13 2020 -0700 summary: rebase: delete unused p1 argument to _concludenode() https://www.mercurial-scm.org/repo/hg/rev/b4abfe142ff6 changeset: 45512:b4abfe142ff6 user:Martin von Zweigbergk date:Fri Sep 18 15:10:14 2020 -0700 summary: rebase: stop clearing on-disk mergestate when running in memory https://www.mercurial-scm.org/repo/hg/rev/22140fd783d2 changeset: 45513:22140fd783d2 bookmark:@ tag: tip user:Antoine cezar date:Wed Sep 16 19:32:53 2020 +0200 summary: run-test: allow relative path in `--blacklist` and `--whitelist` (issue6351) -- Repository URL: https://www.mercurial-scm.org/repo/hg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9062: git: also convert timezone to int (issue6359)
durin42 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Credit to moshez for testing this in the wild. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9062 AFFECTED FILES hgext/git/gitlog.py CHANGE DETAILS diff --git a/hgext/git/gitlog.py b/hgext/git/gitlog.py --- a/hgext/git/gitlog.py +++ b/hgext/git/gitlog.py @@ -389,7 +389,7 @@ sig = pygit2.Signature( encoding.unifromlocal(stringutil.person(user)), encoding.unifromlocal(stringutil.email(user)), -timestamp, +int(timestamp), -int(tz // 60), ) oid = self.gitrepo.create_commit( To: durin42, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel