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
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
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
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
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
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.