Thu, 17 Sep 2020 23:09:47 -0700 mergestate: move commit() from base class to on-disk subclass
Martin von Zweigbergk <martinvonz@google.com> [Thu, 17 Sep 2020 23:09:47 -0700] rev 45501
mergestate: move commit() from base class to on-disk subclass The commit message doesn't do anything in the in-memory case, and it's `_makerecords()` is also not needed in that case, so let's move it down to the on-disk subclass (i.e. the `mergestate` class). Sorry I missed this earlier. Differential Revision: https://phab.mercurial-scm.org/D9043
Thu, 17 Sep 2020 23:12:48 -0700 mergestate: make in-memory mergestate not clear on-disk mergestate on reset()
Martin von Zweigbergk <martinvonz@google.com> [Thu, 17 Sep 2020 23:12:48 -0700] rev 45500
mergestate: make in-memory mergestate not clear on-disk mergestate on reset() Oops, I thought I had remove the `rmtree()` call earlier. Maybe I accidentally got it back in a histedit or something. Differential Revision: https://phab.mercurial-scm.org/D9042
Tue, 15 Sep 2020 16:10:16 -0700 merge: use in-memory mergestate when using in-memory context
Martin von Zweigbergk <martinvonz@google.com> [Tue, 15 Sep 2020 16:10:16 -0700] rev 45499
merge: use in-memory mergestate when using in-memory context This is my version of Augie's D8568. It makes it so we don't touch the mergestate on disk when using an in-memory context. The reason that I want this is not the same as the reason that Augie write his patch (though I agree with that reason too). My hope is to make in-memory rebase not fall back to on-disk rebase when there are conflict. I plan to do that by adding a `overlayworkingctx.reflect_in_workingcopy()`. The idea is that that will update the working copy, the dirstate and the mergestate as necessary. Differential Revision: https://phab.mercurial-scm.org/D9040
Tue, 15 Sep 2020 11:17:24 -0700 mergestate: extract a base class to be shared by future memmergestate
Martin von Zweigbergk <martinvonz@google.com> [Tue, 15 Sep 2020 11:17:24 -0700] rev 45498
mergestate: extract a base class to be shared by future memmergestate This extracts a new base class from `mergestate` and leaves all the vfs-touching code in `mergestate`. Differential Revision: https://phab.mercurial-scm.org/D9039
Tue, 15 Sep 2020 11:33:26 -0700 mergestate: extract overridable methods for making/restoring file backups
Martin von Zweigbergk <martinvonz@google.com> [Tue, 15 Sep 2020 11:33:26 -0700] rev 45497
mergestate: extract overridable methods for making/restoring file backups In-memory merge currently still uses on-disk mergestate. That's mostly harmless (I don't think I've seen any problem it's actually caused). It's still a little weird. I'm planning to add an in-memory mergestate, which will be used with `overlayworkingctx`. This patch prepares for that by extracting that logic, so it's easier to change per subclass. Differential Revision: https://phab.mercurial-scm.org/D9038
Wed, 16 Sep 2020 13:39:26 -0700 mergestate: initialize all properties in __init__()
Martin von Zweigbergk <martinvonz@google.com> [Wed, 16 Sep 2020 13:39:26 -0700] rev 45496
mergestate: initialize all properties in __init__() This is hopefully not very controverial. I found the initialization before this patch unorthodox. It wasn't clear which properties the object was supposed to have. Differential Revision: https://phab.mercurial-scm.org/D9037
Thu, 17 Sep 2020 19:33:55 -0700 mergestate: remove unnecessary clearing of `localctx` and `otherctx`
Martin von Zweigbergk <martinvonz@google.com> [Thu, 17 Sep 2020 19:33:55 -0700] rev 45495
mergestate: remove unnecessary clearing of `localctx` and `otherctx` As noted in the previous commit, there are no callers that (re-)use the instance after calling `reset()`. There are also no callers that call `_read()` after doing anything with the instance (it's only called right after an instance is created). If reviewers feel that this is too risky, I can extract and reuse the poisoning code that indygreg once added for poisining repo instances. Differential Revision: https://phab.mercurial-scm.org/D9036
Wed, 16 Sep 2020 13:25:49 -0700 mergestate: move most of of reset() into start()
Martin von Zweigbergk <martinvonz@google.com> [Wed, 16 Sep 2020 13:25:49 -0700] rev 45494
mergestate: move most of of reset() into start() `ms.reset()` has somehow become a combination of two different things: 1. A constructor-like function creating an empty instance 2. A call to `shutil.rmtree()` to clear the mergestate. It seems that all callers now care only about the latter (since we changed one caller to use the new `ms.start()` method instead). Let's move the code for the former into `start()`, since that's the only place it's needed. Differential Revision: https://phab.mercurial-scm.org/D9035
Thu, 17 Sep 2020 09:23:21 -0700 mergestate: make clean() only be about creating a clean mergestate
Martin von Zweigbergk <martinvonz@google.com> [Thu, 17 Sep 2020 09:23:21 -0700] rev 45493
mergestate: make clean() only be about creating a clean mergestate This is similar to the previous patch, but moves the separation one step further out, to `merge.py`. Differential Revision: https://phab.mercurial-scm.org/D9034
Wed, 16 Sep 2020 10:09:37 -0700 mergestate: split up reset() for its two use cases
Martin von Zweigbergk <martinvonz@google.com> [Wed, 16 Sep 2020 10:09:37 -0700] rev 45492
mergestate: split up reset() for its two use cases We only have one place that calls `ms.reset()` with any arguments. That place is `mergestate.clean()`. The callers that call the function with no arguments seem to all just want delete the mergestate -- none of them look at the instance after calling `reset()`. Let's separate out the two different use cases to make the code clearer. I'll clean up further soon. Differential Revision: https://phab.mercurial-scm.org/D9033
Tue, 15 Sep 2020 23:19:14 -0700 mergestate: simplify reset(), knowing that `other` and `node` go together
Martin von Zweigbergk <martinvonz@google.com> [Tue, 15 Sep 2020 23:19:14 -0700] rev 45491
mergestate: simplify reset(), knowing that `other` and `node` go together There's only one caller of `reset()` that passes any arguments at all, and that originates from `merge.py:1371`. That code always passes values for both `node` and `other`. Differential Revision: https://phab.mercurial-scm.org/D9032
Tue, 15 Sep 2020 22:40:26 -0700 mergestate: make some callers not pass pointless node argument
Martin von Zweigbergk <martinvonz@google.com> [Tue, 15 Sep 2020 22:40:26 -0700] rev 45490
mergestate: make some callers not pass pointless node argument The node argument is set on the created `mergestate` instance, but these callers don't even look at that instance. Differential Revision: https://phab.mercurial-scm.org/D9031
Thu, 17 Sep 2020 09:56:05 -0700 py3: don't risk passing a None value to error.ManifestLookupError()
Martin von Zweigbergk <martinvonz@google.com> [Thu, 17 Sep 2020 09:56:05 -0700] rev 45489
py3: don't risk passing a None value to error.ManifestLookupError() This makes the test case added in 20dd2a259b0f (test-grep: add tests for --follow with/without --diff and/or paths, 2020-09-11) pass on Python 3. Differential Revision: https://phab.mercurial-scm.org/D9030
Thu, 03 Sep 2020 13:25:29 +0530 merge: move initial handling of mergeactions near to later one
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 03 Sep 2020 13:25:29 +0530] rev 45488
merge: move initial handling of mergeactions near to later one We build `mergeactions` in the beginning and use it in end. Let's build it just before where it will be used. Helps making code much easier to understand. Differential Revision: https://phab.mercurial-scm.org/D8983
Thu, 25 Jun 2020 13:16:55 +0530 upgrade: support running upgrade if repository has share-safe requirement
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 25 Jun 2020 13:16:55 +0530] rev 45487
upgrade: support running upgrade if repository has share-safe requirement This helps us in testing changing requirements of source repository and checking that the shared repository works. Differential Revision: https://phab.mercurial-scm.org/D8660
Thu, 17 Sep 2020 18:49:57 -0700 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 17 Sep 2020 18:49:57 -0700] rev 45486
config: add `--shared` flag to edit config file of shared source With `format.exp-share-safe` enabled, we now read the `.hg/hgrc` of the shared source also. This patch adds `--shared` flag to `hg config` command which can be used to edit that shared source config file. It only works if the repository is shared one and is shared using the safe method. Differential Revision: https://phab.mercurial-scm.org/D8659
Thu, 02 Jul 2020 16:23:36 +0530 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 02 Jul 2020 16:23:36 +0530] rev 45485
localrepo: load the share source .hg/hgrc also in share-safe mode (API) The second part of the Share Safe Plan is to share source repo config also. This patch adds logic to load the source repo .hg/hgrc if we are in share safe mode. On unshare, we copy and prepend source config to current repo so that config which was shared is persisted. A test is added to show that now if we enable a hook on the source repo, that also runs on the shared repositories. API change as a new optional argument sharedvfs added to localrepo.loadhgrc() Differential Revision: https://phab.mercurial-scm.org/D8656
Fri, 07 Aug 2020 17:42:15 +0530 helptext: document exp-sharesafe in internals/requirements.txt
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 07 Aug 2020 17:42:15 +0530] rev 45484
helptext: document exp-sharesafe in internals/requirements.txt `exp-sharesafe` is a new requirement and we should document it. Differential Revision: https://phab.mercurial-scm.org/D8914
Tue, 14 Apr 2020 21:07:09 +0530 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 14 Apr 2020 21:07:09 +0530] rev 45483
share: introduce config option to store requires in .hg/store This introduces a config option which enabled stores the requirements on a repository in store instead. When enabled, `.hg/requires` will contain the `share-safe` requirement which marks that the requirements are present in the store. This is done so that repository requirements can be shared with shares made using `hg share` command. After this patch, `hg share` checks whether the source repository has share-safe requirement, if yes, it does not copy the requirements. Test for the new functionality is added and a test case in exitsing share tests is also added. Differential Revision: https://phab.mercurial-scm.org/D8633
Fri, 07 Aug 2020 16:11:19 +0530 scmutil: introduce filterrequirements() to split reqs into wc and store ones
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 07 Aug 2020 16:11:19 +0530] rev 45482
scmutil: introduce filterrequirements() to split reqs into wc and store ones In upcoming patches where we try to implement requirements in store, we will need a mechanism to split all requirements on some basis and decide which one goes to `.hg/requires` and which one goes to `.hg/store/requires`. This patch introduce a separate function for that. Filtering logic for now is put under an `if False:`. In upcoming patches it will be removed. Differential Revision: https://phab.mercurial-scm.org/D8913
Thu, 17 Sep 2020 18:28:53 -0700 remotefilelog: acquire lock before writing requirements on clone
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 17 Sep 2020 18:28:53 -0700] rev 45481
remotefilelog: acquire lock before writing requirements on clone Performing a shallow clone in remotefilelog does not acquire lock. This leads to following warning when we try to write some requirements in store: ``` --- /home/gps/src/hg-committed/tests/test-remotefilelog-share.t +++ /home/gps/src/hg-committed/tests/test-remotefilelog-share.t#safe.err @@ -28,6 +28,7 @@ $ hgcloneshallow ssh://user@dummy/master source --noupdate -q + devel-warn: write with no lock: "requires" at: /home/gps/src/hg-committed/mercurial/scmutil.py:1505 (writerequires) $ hg share source dest updating working directory 1 files updated, 0 files merged, 0 files removed, 0 files unresolved ``` Let's lock before writing the requirements file. Another solution which I can think of is not warn about missing lock when writing to requires file in store. Differential Revision: https://phab.mercurial-scm.org/D8952
Thu, 10 Sep 2020 14:23:12 +0900 grep: make -frREV follow history from the specified revision (BC)
Yuya Nishihara <yuya@tcha.org> [Thu, 10 Sep 2020 14:23:12 +0900] rev 45480
grep: make -frREV follow history from the specified revision (BC) This is close to what "log -frREV" will do, and is backported from 8b4b9ee6001a, "log: make -fr show complete history from the given revs" except for the "del opts['follow']" bit. I'm planning to rewrite cmdutil.walkchangerevs() to share the core logic with logcmdutil, and this is the first step towards that. There are still many broken tests, but the fundamental behavior should be fixed by this patch. .. bc:: `hg grep -fr REV` now follows history from the specified `REV`, works in the same way as `hg log -fr REV`. The previous behavior was to limit the search space to `REV` while following the history.
Fri, 11 Sep 2020 18:33:41 +0900 cmdutil: make walkchangerevs() gracefully handle wdir parents
Yuya Nishihara <yuya@tcha.org> [Fri, 11 Sep 2020 18:33:41 +0900] rev 45479
cmdutil: make walkchangerevs() gracefully handle wdir parents This code will be completely rewritten, but test-grep.t would fail without fixing it.
Thu, 10 Sep 2020 13:30:34 +0900 grep: fix --follow with no --diff nor --rev to not fall back to plain grep
Yuya Nishihara <yuya@tcha.org> [Thu, 10 Sep 2020 13:30:34 +0900] rev 45478
grep: fix --follow with no --diff nor --rev to not fall back to plain grep Before, "grep --follow" would only print matches in the working directory. Since --follow is the option to specify the search space, it should disable the plain (i.e. wdir) grep.
Fri, 11 Sep 2020 12:39:45 +0900 test-grep: add tests for --follow with/without --diff and/or paths
Yuya Nishihara <yuya@tcha.org> [Fri, 11 Sep 2020 12:39:45 +0900] rev 45477
test-grep: add tests for --follow with/without --diff and/or paths This tests the behavior of cmdutil.walkchangerevs(). I'm going to rewrite cmdutil.walkchangerevs() to leverage the "log -f" logic, but the code coverage looked quite small. And the history traversal of "grep -f" goes wrong in various ways.
Thu, 10 Sep 2020 13:10:53 +0900 grep: clarify that --all works exactly the same way as --diff
Yuya Nishihara <yuya@tcha.org> [Thu, 10 Sep 2020 13:10:53 +0900] rev 45476
grep: clarify that --all works exactly the same way as --diff 7fbb5d76c555 "grep: add --diff flag" says as such, but the help strings have diverged since, and it's getting fuzzier what this --all will do.
Thu, 17 Sep 2020 15:34:13 +0200 churn: add an usage example in docstring
"Stephane" <stephane@yaal.fr> [Thu, 17 Sep 2020 15:34:13 +0200] rev 45475
churn: add an usage example in docstring
Thu, 17 Sep 2020 15:47:19 +0530 tests: run test-check-py3-compat only in pure python mode
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 17 Sep 2020 15:47:19 +0530] rev 45474
tests: run test-check-py3-compat only in pure python mode This test was added few years ago to detect syntax and import related warnings and kickstart the python-3 porting efforts. It tries to parse the ast and import the module. When using in strict modes like `HGMODULEPOLICY=rust` or `HGMODULEPOLICY=c`, the test fails. Let's run the test only on pure python mode. We now have full test suite being run with python 3 and some people even use hg with python 3 in production (like me).
Sat, 12 Sep 2020 07:23:47 +0900 log: make -frREV PATH detect missing files before falling back to slow path
Yuya Nishihara <yuya@tcha.org> [Sat, 12 Sep 2020 07:23:47 +0900] rev 45473
log: make -frREV PATH detect missing files before falling back to slow path If -rREV isn't specified, "log --follow" would abort on nonexistent paths. Let's implement this behavior for "-frREV" case as we have ctx.hasdir() now. Otherwise "log -frREV PATH" would silently fall back to slow path and files wouldn't be followed across renames. The loop is quadratic (as before), but the size of the startctxs and match.files() should be small in general. Some tests are marked as BROKEN since file renames aren't tracked in the slow path. This is a known limitation of the current history traversal function.
Fri, 11 Sep 2020 15:13:35 +0900 log: fix -fr'wdir()' PATH to follow newly added file
Yuya Nishihara <yuya@tcha.org> [Fri, 11 Sep 2020 15:13:35 +0900] rev 45472
log: fix -fr'wdir()' PATH to follow newly added file Testing filelog doesn't make sense in this case because the file existence is tested against the specified changectxs. If the filelog is empty and if startctxs != [wctx], 'f not in c' should be triggered.
(0) -30000 -10000 -3000 -1000 -300 -100 -50 -30 +30 +50 +100 +300 +1000 +3000 tip