Commit Graph

12 Commits

Author SHA1 Message Date
Mark Thomas
ea556b4862 hggit: use repo.sharedvfs instead of creating a vfs
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
2018-09-28 07:23:00 -07:00
Jun Wu
1dc9519dda registrar: add a namespace predicate
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
2018-09-11 19:51:56 -07:00
Durham Goode
e348c3c98c hggit: use transactions during git import
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
2018-08-07 18:07:08 -07:00
Jun Wu
578077cc98 hggit: drop gitignore support
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
2018-07-06 10:36:17 -07:00
Jun Wu
a487dacc4b codemod: reformat rest of the code
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
2018-07-05 17:52:43 -07:00
Lukasz Langa
dfda82e492 Upgrade to 18.5b1
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
2018-05-30 02:23:58 -07:00
Durham Goode
241ab4bdad hg: add hggit.disallowinitbare config option
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
2018-04-13 21:51:54 -07:00
Mark Thomas
fd9fbe1f27 hggit: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329502

fbshipit-source-id: e12c77f511034ecedd521709523c3674c133d181
2018-04-13 21:51:33 -07:00
Jun Wu
2946a1c198 codemod: use single blank line
Summary: This makes test-check-code cleaner.

Reviewed By: ryanmce

Differential Revision: D6937934

fbshipit-source-id: 8f92bc32f75b9792ac67db77bb3a8756b37fa941
2018-04-13 21:51:08 -07:00
Jun Wu
ec2892be0d hggit: disable warnings from newer dulwich
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
2018-04-13 21:51:02 -07:00
Phil Cohen
c97e746105 simplecache: fix for hggit
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
2018-04-13 21:50:55 -07:00
Ryan McElroy
66bd74e558 hggit: internalize extension
Test Plan: run-tests-.py

Reviewers: mitrandir, #mercurial

Reviewed By: mitrandir

Subscribers: ps, terrelln

Differential Revision: https://phabricator.intern.facebook.com/D6675896

Tasks: T24908724

Signature: 6675896:1515448382:df8d80cd7356ae8f5fb04586dc4a0a651bc498fd
2018-01-09 06:08:01 -08:00