sapling/tests/test-share-unshare.t
Phil Cohen c7ff97160f share: fix hg unshare
Summary:
This was blocking us default-enabling `fbsparse`; however, this function is actually incredibly fragile and can break with a variety of extensions enabled (even blackbox).

E.g., try this on the latest release and you'll get an exception!

```
cd $(mktemp -d); hg init a; hg share a b; cd b; hg unshare
```

That particular breakage is called by blackbox trying to look at `repo[None]` to do some logging, but anything that tries to read `repo.dirstate` after this will print the exception. The root cause is this line which is trying to override `repo.root`:

```
repo.unfiltered().__init__(repo.baseui, repo.root)
```

It's trying to update the repo's path to indicate that it is independent and no longer shared. But, the initializer isn't really designed to be called twice, AFAICT, and doing so here leaves the property caches out of sync with properties of the repo (namely `_filecache`).

Durham's suggestion was just to nuke `hg unshare`. This patch works around it for now, though, in case we want to keep it alive.

Reviewed By: quark-zju

Differential Revision: D6758397

fbshipit-source-id: 90d3773d9340f2a5b2e6e900a2194d8b931f410d
2018-04-13 21:50:53 -07:00

15 lines
271 B
Perl

Share works with blackbox enabled:
$ cat <<EOF >> $HGRCPATH
> [extensions]
> blackbox =
> share =
> EOF
$ hg init a
$ hg share a b
updating working directory
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd b
$ hg unshare