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
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
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.
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.
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.
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.
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.
"Stephane" <stephane@yaal.fr> [Thu, 17 Sep 2020 15:34:13 +0200] rev 45475
churn: add an usage example in docstring
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).
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.
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.
Yuya Nishihara <yuya@tcha.org> [Fri, 11 Sep 2020 15:08:58 +0900] rev 45471
log: reorganize if-else and for loop in logcmdutil._makematcher()
The test conditions are branchy depending on --follow and --rev options,
so it should be better to switch first by --follow --rev.
Note that revs is not empty so "if follow and startctxs" can be replaced
with "if follow and opts.get(b'rev')".
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 26 Aug 2020 16:37:23 +0530] rev 45470
merge: update commitinfo from all mergeresults during bid merge
During bid merge, it's not clear which commitinfo should be stored and which one
should not. This depends on which side the bid merge chooses for a file. For
this we will need to refactor bid merge code and commitinfo handling.
For now, we just blindly updates info since we hardly have any users of
commitinfo and this will help us in testing and clearing out further path.
Differential Revision: https://phab.mercurial-scm.org/D8965
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 24 Aug 2020 17:22:28 +0530] rev 45469
merge: add missing ACTION_KEEP when both remote and ancestor are not present
Previous patch may lead to confusion that the related criss-cross merge is
consistent when done from any of the parents. However this is not true and we
were missing setting an ACTION_KEEP.
This patch now exposes that bid-merge favors ACTION_KEEP always and the result
of merge is different when started from different parents.
This change also effects a test case above where bid merge was wrongly picking
`r` because it was missing keep related information from one of the ancestor.
After this test, we are back in a state in the criss-cross merge tests where the
result depends on which parent we are merging from.
Differential Revision: https://phab.mercurial-scm.org/D8941
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 24 Aug 2020 15:20:09 +0530] rev 45468
merge: store ACTION_KEEP_ABSENT when we are keeping the file absent locally
If a file is not present on the local side, and it's unchanged between other
merge parent and ancestor, we don't use any action, neither we had a if-else
branch for that condition. This leads to bid-merge missing that there is a
such action possible which can be performed.
As test changes demonstrate, we now choose the locally deleted side instead
of choosing the remote one consistently. This is also wrong behavior which is
resulted because of missing possible action. It will be fixed in next patch.
This whole logic is not acurrate as we should prompt user on what to do
when this kind of criss-cross merge is in play.
Differential Revision: https://phab.mercurial-scm.org/D8940
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 01 Sep 2020 17:08:26 +0530] rev 45467
merge: add `ACTION_KEEP_ABSENT` to represent files we want to keep absent
There are files which were deleted/not present in working copy parent but were
present on other side of merge. On merge, we might decide to keep them deleted.
We want to track such cases more closely, rather all kind of cases which results
from some kind of merging logic.
We do have `ACTION_KEEP` but having a dedicated action for the absent case is
more cleaner.
Initially I named the action as `ACTION_KEEP_DELETED` but later realized that
file can be not-present because of other reasons than deletion like rename,
hence decided to use more generic name `ACTION_KEEP_ABSENT`.
Differential Revision: https://phab.mercurial-scm.org/D8974