Summary: Update hggit to use the new repo.sharedvfs, rather than constructing its own.
Reviewed By: quark-zju
Differential Revision: D9699166
fbshipit-source-id: 21198d889085f368339d48b8b1ed9698d3e6a51a
Summary:
Previously, there is no easy API to add a namespace with desired order. There
is `extensions.afterloaded`, but that only works for `ui/extsetup`, not for
`reposetup`.
This diff add a namespace predicate so registering a namespace is similar to
registering a revset. It also provides an optional `after` parameter to define
the desired order, like:
from mercurial import registrar, namespaces
namespacepredicate = registrar.namespacepredicate()
namespacepredicate("svn", after=["remotenames"])
def svn(repo):
return namespaces.namespace("svn", ...)
Existing namespaces will be migrated by upcoming changes.
This is useful for things wanting to resolve custom names, like globalrevs and
commit cloud.
Reviewed By: singhsrb
Differential Revision: D9775703
fbshipit-source-id: f15827b042d605b9cebc1ee1af6479903f47ee9c
Summary:
Previously hggit used a single transaction for each commit it imported.
This added a lot of over head, such as writing the fncache every time and
committing to sql every time.
Instead, let's use a transaction that lasts a while. We'll tie it to the
existing gitmap save logic, so that we commit commits to disk before writing the
map file (so the map file never references commits that don't exist).
Reviewed By: quark-zju
Differential Revision: D9210162
fbshipit-source-id: 9b1302dfc824055742c4194dfaea7e172e5db6b4
Summary:
The gitignore implementation in core is more complete (support "!" rules)
and efficient (in native Rust). So let's drop the gitignore support in
hggit.
Reviewed By: singhsrb
Differential Revision: D8744807
fbshipit-source-id: faecace0ab0d5a0e015f50473dd1e0c232d013ff
Summary:
Previous code format attempt (D8173629) didn't cover all files due to `**/*.py`
was not expanded recursively by bash. That makes certain changes larger than
they should be (ex. D8675439). Now use zsh's `**/*.py` to format them.
Also fix Python syntax so black can run on more files, and all lint issues.
Reviewed By: phillco
Differential Revision: D8696912
fbshipit-source-id: 95f07aa0c5eb1b63947b0f77f534957f4ab65364
Summary: Mostly empty lines removed and added. A few bugfixes on excessive line splitting.
Reviewed By: quark-zju
Differential Revision: D8199128
fbshipit-source-id: 90c1616061bfd7cfbba0b75f03f89683340374d5
Summary:
The hg servers were having trouble bootstrapping the .hg/git directory
because hggit was creating a bare repo and then later git fetches were super
slow. Those .hg/git directories should be managed by infra outside of hg, so
let's add a config knob to prevent hggit from creating a .hg/git repo.
Reviewed By: quark-zju
Differential Revision: D7586441
fbshipit-source-id: 7c2578123428aadaa6a94484e45dda6bd6b5a42d
Summary:
Newer dulwich will issue warnings that break hggit tests, like:
```
--- hg/tests/test-hggit-merge.t
+++ hg/tests/test-hggit-merge.t.err
@@ -32,6 +32,26 @@
Initialized empty Git repository in $TESTTMP/gitrepo2/
$ hg clone gitrepo hgrepo | grep -v '^updating'
+ hggit/git_handler.py:1250: DeprecationWarning: Use FetchPackResult.refs instead.
+ return ret if ret else {}
+ hggit/git_handler.py:278: DeprecationWarning: Use FetchPackResult.refs instead.
+ if refs:
+ hggit/git_handler.py:1285: DeprecationWarning: Use FetchPackResult.refs instead.
+ for ref, sha in refs.iteritems():
+ hggit/git_handler.py:1295: DeprecationWarning: Use FetchPackResult.refs instead.
+ return util.OrderedDict((r, refs[r]) for r in filteredrefs)
+ hggit/git_handler.py:1379: DeprecationWarning: Use FetchPackResult.refs instead.
+ keys = refs.keys()
+ hggit/git_handler.py:1415: DeprecationWarning: Use FetchPackResult.refs instead.
+ heads = dict([(ref[11:], refs[ref]) for ref in refs
+ hggit/git_handler.py:1416: DeprecationWarning: Use FetchPackResult.refs instead.
+ if ref.startswith('refs/heads/')])
+ hggit/git_handler.py:285: DeprecationWarning: Use FetchPackResult.refs instead.
+ symref = refs['HEAD']
+ hggit/git_handler.py:289: DeprecationWarning: Use FetchPackResult.refs instead.
+ rnode = refs['refs/heads/%s' % rhead]
+ hggit/git_handler.py:1451: DeprecationWarning: Use FetchPackResult.refs instead.
+ for ref_name, sha in refs.iteritems():
importing git objects into hg
```
Since hggit code still needs to support newer and older dulwich,
Ignore the warnings to make the test pass.
Reviewed By: DurhamG
Differential Revision: D6881696
fbshipit-source-id: 576940be99bcce1ee194cff0cdc655b16c8a6e83
Summary:
When used with hggit, simplecache would treat all hggit overlayctxs as having the `nullid` node. This is used in the cache key for the result of `status()`; this caused the return value of all hggit's changectxs' `status()` to be intermingled.
There are arguably two issues here:
- hggit's `overlaychangectx` simply implemented `node()` and didn't set a `_node` like changectx does. Changectx refers to this property internally (and other external callers might do so too) so we should probably set it.
- simplecache was reading the `changectx._node` property instead of the more public `changectx.node()`. This returned `nullid` because of the above.
Either change would fix it but I sent both to be safe. I look forward to tightening the context class interfaces in the future.
(Note: this ignores all push blocking failures!)
Reviewed By: quark-zju
Differential Revision: D6788335
fbshipit-source-id: eb4b3cebc1b6ee6011405cdb7d702cdf5cac0904