Commit Graph

193 Commits

Author SHA1 Message Date
Jun Wu
ca52b70e03 config: enable merge.printcandidatecommmits
Summary:
The feature was completed by Phil in D9816270. It's handy and can probably
reduce user support burden like: https://fb.intern.facebook.com/groups/scm/permalink/2039619916087618/

Therefore let's enable it.

Reviewed By: DurhamG

Differential Revision: D14293405

fbshipit-source-id: 54e934e0bf495c090109462e4f743d427df39380
2019-03-08 19:55:46 -08:00
Jun Wu
f8e28f1466 bookmarks: remove branch name collision check
Summary:
Eventually we'd like "default" to be not a special name. This is one step
torwards that.

Differential Revision: D14233455

fbshipit-source-id: 739091a124bc667c607c283bf00abc66b4081d25
2019-03-08 16:33:20 -08:00
Jun Wu
c0d96cde7d hook: make "mercurial" module available for Python hooks
Summary:
Some hooks (ex. mergedriver) are checked in old release branches. Provide
"mercurial" module compatibility so they won't break.

Reviewed By: mitrandir77

Differential Revision: D14366343

fbshipit-source-id: d47cc4fd512f63e4f6cdc5d7e5ab2c4398216b2f
2019-03-08 16:04:38 -08:00
Mark Thomas
38595d6fe3 dispatch: detect stale virtual checkouts and provide advice
Summary:
If Mercurial detects `ENOTCONN` when trying to open the current directory,
there is a high likelihood this is a disconnected eden virtual checkout.
Provide some advice as to what to do: run `hg fs start`.

Reviewed By: strager

Differential Revision: D13888873

fbshipit-source-id: 7619df0681d15b862d1a6f86d90491aa873bf86b
2019-03-08 06:02:22 -08:00
Mark Thomas
a574573d52 fs: add stats subcommands
Summary: Add `hg fs stats` for the edenfs stats commands.

Reviewed By: chadaustin

Differential Revision: D14007060

fbshipit-source-id: 453133d04867a90fd7a40bc05288e35ae56fad93
2019-03-08 06:02:22 -08:00
Mark Thomas
e7bd8088ef fs: add other subcommands
Summary: Add `hg fs` subcommands for the other main `edenfsctl` commands.

Reviewed By: chadaustin

Differential Revision: D14007062

fbshipit-source-id: 9b5f56b14b5812216c929232b2697233f38288cc
2019-03-08 06:02:22 -08:00
Mark Thomas
c202c9953b fs: add start, stop and restart subcommands
Summary:
Add `hg fs start`, `hg fs stop` and `hg fs restart` subcommands to start, stop
and restart the eden daemon.

Reviewed By: chadaustin

Differential Revision: D13888876

fbshipit-source-id: ab190675d2b2ad56f38d723d1859f516aa3165e8
2019-03-08 06:02:21 -08:00
Mark Thomas
d7375d7397 visibility: update visibility when commits are modified
Summary:
When commits are added or modified, update the set of visible heads if
visibility tracking is enabled.

Reviewed By: DurhamG

Differential Revision: D12980779

fbshipit-source-id: 8f44045159c86a374ae530fa4327ee0807b4320d
2019-03-08 03:05:58 -08:00
Mark Thomas
cfbe15d7d2 visibility: add storage of visible heads
Summary:
Add a method of tracking explicit visible heads.  Rather than using the
implicit set of commits that are not obsoleted (which may differ between repos
that are connected to a single commit cloud workspace), we instead track commit
visibility explicitly.

This is more like the git model, where only commits that are reachable from
refs are considered for most operations, except that we keep track of the heads
automatically, and use obsmarkers to keep track of the obsoleted commits,
rather than garbage collecting them.

Reviewed By: DurhamG

Differential Revision: D9560361

fbshipit-source-id: 07dabfc04415f2ecb97d57c4e3944c071579ee50
2019-03-08 03:05:57 -08:00
Mark Thomas
edbb3112bd templatekw: disable obsolescence fate templates when mutation enabled
Summary:
Disable the various templates that attempt to determine the fate of a
particular commit based on obsmakers when mutation is enabled.  The old
templates were either insufficiently generic (e.g. `amendsuccessors`), or
leaked internal implementation (e.g. `succsandmarkers`).

With mutation enabled, callers should use the `mutations` template to get a
list of a commit's mutations.

Reviewed By: DurhamG

Differential Revision: D12980772

fbshipit-source-id: 920d47f7c61ad52f562cd90f1cb405250c14bc25
2019-03-08 03:05:57 -08:00
Mark Thomas
3b41f2f54c mutation: detect landed commits using synthetic mutation records
Summary:
Add support for detecting landed commits.

Since we don't currently have an index for successor information in the
changelog, we can only detect the successor relationship for predecessors of
draft commits (for which we build a cache).  As a temporary workaround,
make it possible to put mutation records in the mutation store that lead to
landed commits.  These will allow land detection to work until we have a
changelog that supports indexing on predecessor.

Reviewed By: quark-zju

Differential Revision: D12980780

fbshipit-source-id: d7b14fa073d0406990b92731fe66dfe1c73b404c
2019-03-08 03:05:57 -08:00
Mark Thomas
2e67ee0c44 templatekw: add mutations template keyword
Summary:
The `mutations` template keyword expands to a list of the results of mutating
the commit.  Each element of the list has an `operation` field, which is a
string describing the mutation operation, and a `successors` field, which is a
list of the successor commits for this operation.  Sequences of mutations that
result in a single successor are collapsed into a single `rewrite` operation.

Reviewed By: quark-zju

Differential Revision: D12980787

fbshipit-source-id: 82be2f9131832209cc3ab088f587c45f8c45a9ad
2019-03-08 03:05:57 -08:00
Mark Thomas
6ce749a3e1 infinitepush: exchange mutation information via infinitepush bundles
Summary:
Include mutation records for all predecessors of the pushed commits in
infinitepush bundles.

When received from infinitepush, store these additional records in the local
store.  This allows us to bridge any gaps in mutation that are omitted from the
local commits when they are received from infinitepush.

Reviewed By: DurhamG, quark-zju

Differential Revision: D12980777

fbshipit-source-id: b1535ca29c0fca3e6cb0f563d78c4c60d4aef58e
2019-03-08 03:05:57 -08:00
Mark Thomas
13a768d274 debugcommands: support mutation store in debugmutation
Summary:
The debugmutation command should also show information about mutation entries
in the mutation store.

Reviewed By: DurhamG, quark-zju

Differential Revision: D12980785

fbshipit-source-id: 06c3ec2cb9c42edf43729ba3b7c471b1bf8dfb96
2019-03-08 03:05:57 -08:00
Mark Thomas
78d4d4ce49 mutation: look-up entries in the store when traversing mutations
Summary:
When traversing mutation entries, if we don't have any information for a
commit, then look instead in the store to see if we have a cached entry
from a non-local commit there.

There aren't any ways of putting entries there, yet.  Those will come in
later commits.

Reviewed By: DurhamG

Differential Revision: D12980776

fbshipit-source-id: 63ff12382eb9294aa43ff100a4fe19b7c05f9e61
2019-03-08 03:05:57 -08:00
Mark Thomas
6ff8a8a394 mutation: create common access methods for mutation information
Summary:
We will be making looking up entries for complex by adding a secondary store of
the information.  Make accesses to this information common through lookup
functions.

Reviewed By: quark-zju

Differential Revision: D13279986

fbshipit-source-id: a30084b548762e69cb354c3760d7ec66027a24e1
2019-03-08 03:05:57 -08:00
Mark Thomas
b059c3a3bf mutation: implement successorssets and foreground
Summary:
Implement successorssets and foreground in terms of mutation records and
replace them when mutation metadata usage is enabled.

Reviewed By: quark-zju

Differential Revision: D10149263

fbshipit-source-id: bbf6d1fc44a9787660147e15936a9ee1951373ca
2019-03-08 03:05:56 -08:00
Mark Thomas
892986d685 mutation: use mutation information for revsets
Summary:
When enabled, use mutation metadata for the `obsolete`, `extinct`, `orphan`,
`phasedivergent` and `contentdivergent` revsets.

Reviewed By: quark-zju

Differential Revision: D10149265

fbshipit-source-id: 5559fa22a6025e1d341538f3eb2257d8efee15e5
2019-03-08 03:05:56 -08:00
Mark Thomas
a14bfeebbb mutation: add mutationcache
Summary:
Add a mutationcache to the repo.  This computes the following information:

* The successor sets for all predecessors of visible commits - these are the
  sets of immediate successors for each commit.
* A map from commits which are the results of splits to the final split commit.
* The set of public commits that have visible draft successors.
* The set of draft commits that have multiple sets of visible eventual successors.
* The set of obsolete commits - draft commits with visible eventual successors.
* The set of orphan commits - commits with obsolete ancestors.
* The set of extinct commits - obsolete commits with no orphaned descendants.

These sets will be used later on to replace the obsmarker-based equivalents.

Reviewed By: DurhamG

Differential Revision: D13279988

fbshipit-source-id: 3f063bb68aaba2f19da257efdf79b485b947b7b1
2019-03-08 03:05:56 -08:00
Jun Wu
426a80a117 zstd: back out "make Python APIs zero-copy"
Summary:
Original commit changeset: af43d4cce555

D14338313 didn't trigger the main `.t` tests. A lot of things actually
depend on `zstd` APIs returning `bytes`. Therefore back out the change.

Reviewed By: DurhamG

Differential Revision: D14372351

fbshipit-source-id: d8daa7d1d2a49d9d0c4d48de22ed0567d1d953a7
2019-03-07 13:30:10 -08:00
Jun Wu
932bb1492c zstd: make Python APIs zero-copy
Summary:
Make them zero-copy to reduce overhead. A side effect is the types become
`bytearray`, instead of `bytes`. It seems fine for zstd use-case.

Reviewed By: ikostia

Differential Revision: D14338313

fbshipit-source-id: af43d4cce5559fe877373737a71e1e1678a17ca7
2019-03-06 21:35:10 -08:00
Stanislau Hlebik
48e7592c3e localrepo: fix changed file generation
Summary:
If an executable filenode was reused from p2 and mode hasn't been
changed (i.e. a filenode was executable and it is still an executable after a
merge) and and p1 didn't have this file at all then file will still be listed as
changed just because manifest1.flags(fname) returns ''.

After this diff if a filenode is reused then file will be listed as changed
only if it's a parent from where this filenode was reused have different flags.
So if filenode was reused from p1/p2 and p1/p2 has same flags and new
filenode, then file is not listed. But if filenode was reused from p1 and p1
has different flags, then filenode won't be reused.

It's possible that both new filenode is equal to both p1 and p2. In that case
we'll compare only with p1's mode.

Note that it's only get triggered during pushrebase, because during local
commits `fctx.filenode()` is None

Reviewed By: DurhamG

Differential Revision: D14300214

fbshipit-source-id: 1bf6c4802cfce5db6654da673333a56389432617
2019-03-05 10:53:32 -08:00
Arun Kulshreshtha
b855ea2fbc fileserverclient: add ability to request packs over http
Summary: Allow file data/history packs to be fetched via HTTP when the Eden API is enabled.

Reviewed By: quark-zju

Differential Revision: D14257368

fbshipit-source-id: 8b6823a57a6fdef546a596df20387b3fc1ccdd4a
2019-02-28 17:10:47 -08:00
Arun Kulshreshtha
5f578e136c remotefilelog: add debuggethistory command
Summary: This diff adds a new `hg debuggethistory` command that takes filenode/path pairs from stdin, fetches the history of the files from the API server, and writes the results to a historypack in the hg cache.

Reviewed By: quark-zju

Differential Revision: D14248082

fbshipit-source-id: 8014a758abd3a578ea213d8d3177812629b2fd51
2019-02-28 15:42:17 -08:00
Arun Kulshreshtha
55171a856b remotefilelog: attach edenapi client to repo object
Summary: The Eden API client in Mercurial should be a singleton. This diff assigns the client to `repo.edenapi` so that it is accessible throughout the code.

Reviewed By: quark-zju

Differential Revision: D14233314

fbshipit-source-id: 8e0ed22c32611e8f6e7d4461c3e31870d47a0e95
2019-02-28 15:42:17 -08:00
Adam Simpkins
b360d9ee62 make debugedenimporthelper require an --out-fd argument
Summary:
When using the `debugedenimporthelper` subcommand that is part of `hg` itself
it is much more important to make sure that we don't try to use `stdout` as
the import communication mechanism.

The old `hg_import_helper.py` script more carefully set up its own `UI` object
to try and avoid ever printing any messages to `stdout`.  However it isn't
easily possible to do this as part of the normal `hg` program.  Therefore
abort the command if `hg debugedenimporthelper` is ever run without an
`--out-fd` argument.

This also helps avoid potentially confusing users by printing binary data to
stdout if they invoke accidentally `hg debugedenimporthelper` interactively in
a terminal.

Reviewed By: chadaustin

Differential Revision: D14222372

fbshipit-source-id: 7e0829dff41b2bca28c7f4539b90c6c354f8c79f
2019-02-27 13:44:29 -08:00
Adam Simpkins
a6832788b5 allow hg debugedenimporthelper to use the normal repo object
Summary:
This starts to fix some of the `hg debugedenimporthelper` behavior and make it
work more like most other hg subcommands with respect to how it finds the hg
repository.

Previously the code was copied into hg largely as-is from an external script
that took the repository path as a separate argument.  This resulted in
confusing behavior as it completely ignored the normal repository object
opened by `hg`.

This makes `debugedenimporthelper` honor the normal hg repo object if the
extra repository path argument is not specified.

Reviewed By: chadaustin

Differential Revision: D14222323

fbshipit-source-id: 57048178b588dd1dd7150184665d6c13427d6b56
2019-02-27 13:44:29 -08:00
Mark Thomas
2603eab68c flake8: fix lints for unused imports and variables
Summary:
Fix lint errors involving unused imports and variables.  In some cases we are
relying on the side effect of importing, so tag these with the appropriate
noqa flag.

Reviewed By: ikostia

Differential Revision: D14241398

fbshipit-source-id: b639af47c563f914a54188af48f1f9100442d08f
2019-02-27 06:26:06 -08:00
Jun Wu
304e5c383b push: remove newbranch option
Summary:
`push --new-branch` is very rarely used and it does not make much sense with
checkheads removed (D14179861). Remove it everywhere.

There is still [one user](https://fburl.com/t5hmcxrp) of the
`push --new-branch` flag. Do not remove it just yet.

Reviewed By: singhsrb

Differential Revision: D14212180

fbshipit-source-id: 18f80576ab6464fc36b047a8a35b339231ee9d8e
2019-02-25 17:51:10 -08:00
Mark Thomas
9a19e06fee strip: move extension to core and rename to debugstrip
Summary:
Move the strip extension to core.  Rename the command to `hg debugstrip` as it
is not intended for use by users.  Users should use `hg hide` instead.

Reviewed By: quark-zju

Differential Revision: D14185822

fbshipit-source-id: ef096488cb94b72a7bb79f5bf153c064e0555b34
2019-02-25 03:55:08 -08:00
Jun Wu
56338d7005 branchmap: drop revbranchcache and other unused logic
Summary:
They're no longer used. Drop them. The `branchcache` is still somehow used,
although it's basically equvilent to `{"default": heads}`.

We can probably clean it up further after detached from subversion.

Reviewed By: singhsrb

Differential Revision: D14180592

fbshipit-source-id: 45230d486f203bf3f55e89ce9eb89e6855e14e54
2019-02-22 21:02:41 -08:00
Jun Wu
b8eecfa308 streamclone: drop branchmap code
Summary: It's a no-op already. Drop it.

Reviewed By: singhsrb

Differential Revision: D14180595

fbshipit-source-id: 9f904b818bcf56b9d12405ca9894baa9c786801b
2019-02-22 21:02:41 -08:00
Jun Wu
e188aff028 revset: make "branch(x)" equvilant to "all()"
Summary:
All commits belong to `default` branch. Therefore `branch(x)` can be seen as
just `all()`, assuming `x` is a valid name.

This removes the only user of `repo.revbranchcache`.

In a later step, branch related features will be moved to an extension so the
code becomes separate and features are optional.

Reviewed By: sfilipco

Differential Revision: D14180594

fbshipit-source-id: 9dc52743f1b69a1838114c8c0de5fc69383dc41e
2019-02-22 21:02:41 -08:00
Jun Wu
66f2e5f45e branch: disable branchcache and drop all branches other than "default"
Summary:
This hardcodes several perftweaks configs that have been enabled for major FB
repos for months:

  [perftweaks]
  disablebranchcache = True
  disablebranchcache2 = True
  disableresolvingbranches = True
  disableupdatebranchcacheoncommit = True

Practically, this means the branchmap is now just `{'default': heads}`. (i.e.
there are no named branches other than `default`), and branchcache is removed
(i.e. `.hg/cache` does not exist without clindex or in-repo tags).

This diff only makes easy-to-verify logic changes by assuming the configs and
removing dead code. Things can be further cleaned up. They will be done by
upcoming changes.

Most test changes are due to the fact that `.hg/cache` is no longer created.

Reviewed By: singhsrb

Differential Revision: D14179858

fbshipit-source-id: 479f7427168eb1d9614a973e273a229e50f5620a
2019-02-22 21:02:41 -08:00
Jun Wu
850022dd70 convert: drop cvs support
Summary:
The CVS branch support will break with the upcoming branchcache removal.
CVS repos are rare. Let's just remove the code.

Differential Revision: D14179863

fbshipit-source-id: 890ce34958d2efe4f2ef02b1d72cf92f6269378c
2019-02-22 21:02:41 -08:00
Jun Wu
047b1a05f4 exchange: kill checkheads
Summary:
We had `ui.checkheads=false` set for a long time. Let's remove the feature
entirely and update the tests.

This is necessary before killing the branch cache, as some tests still use
different branches and there would be suddently more "heads" that cause
test issues.

Reviewed By: sfilipco

Differential Revision: D14179861

fbshipit-source-id: 0de76566799a9560b45e823cc5f49cfda9e3dd30
2019-02-22 21:02:41 -08:00
Stanislau Hlebik
8922f8a4b1 hook: make it possible to record stderr of failed python hooks
Summary:
Context: in pushrebase replay job we run on Mononoke we also want to test our
hooks i.e. replay pushrebase requests that were denied on mercurial because of
a hook failure. The problem is that at the moment the only error message we have
is `prepushrebase.driver hook failed` (see xdb table `xdb.mononoke_production`,
query `select * from pushrebaserecording where pushrebase_errmsg like '%hook%'
limit 10;`). This error message tells us nothing, not even what hook failed.

To change it I suggest to make it possible for python hooks to raise HookAbort
and provide more information in the `hook_failure_reason` field.

Reviewed By: quark-zju

Differential Revision: D14131359

fbshipit-source-id: 69a2b51b30c78efadf3ba0d3332f46a777022568
2019-02-22 05:10:46 -08:00
Mark Thomas
7755c9df12 help: use only first line of alias doc strings in command list help
Summary:
Alias documentation can now include multiple lines, however for the output
of `hg help commands`, only the first line should be used.

Reviewed By: quark-zju

Differential Revision: D14149607

fbshipit-source-id: 84992078c9bc4659532350b47694c562f4dc1983
2019-02-20 22:39:13 -08:00
Jun Wu
f6c3848463 commands: remove more branch related CLI flags
Summary:
Remove:
- log --only-branch
- pull --branch
- push --branch
- record --close-branch
- incoming --branch
- outgoing --branch

Currently, `log --branch` is kept since some arcanist code still uses it.
We can probably remove it after the next arcanist release.

Differential Revision: D14116320

fbshipit-source-id: 50960ae8700200b322f615c4defd9c05353c2435
2019-02-20 20:05:29 -08:00
Jun Wu
2dc2a3d2a2 dispatch: do not show help on CommandError
Summary:
CommandError happens if there is an unknown command flag, or a required
argument is missing. The old behavior is to print an error message to
stderr, then start the pager with the command help printed to stdout.

There are 2 problems with that approach:
1. When using mosh, a long help text might flush the actual error to out of the
   screen. The error message will be missed.
2. When captured in shell scripts, the help text printed to stdout would be
   captured, which is almost always undesirable.

The actual motivation of this change is for 2. Zsh themes like bullet-train [1]
uses `hg id -b 2>/dev/null` and we'd like to remove `id -b` support. After that,
the command should not polluate stdout with help text.

[1]: bd88ade263/bullet-train.zsh-theme (L102)

Differential Revision: D14151200

fbshipit-source-id: edd38e91115f96929438379aa2e40edfba560b41
2019-02-20 18:44:35 -08:00
Jun Wu
fba42ecd00 mergedriver: handle queueremove correctly
Summary:
It's possible that the non-mergedriver code path decides to create ("get") a
file, because it only exists in one side of the merge parents, while
mergedriver decides to remove that file. That makes the file exist in both
"g" (get, aka. create) and "r" (remove) lists and result in incorrect
dirstate state.

Fix it by detecting the case and remove the conflicted files from the "g" list.

Reviewed By: DurhamG

Differential Revision: D14145990

fbshipit-source-id: f4e5d9787dca5cda6cae270f8a84296ecddf553c
2019-02-20 18:11:33 -08:00
Mark Thomas
6ee252bb95 debugstatus: print the clock value stored in treestate
Summary: Add the current clock value to the output of `hg debugstatus`

Reviewed By: quark-zju

Differential Revision: D14150641

fbshipit-source-id: 917ac3095bc933c042c0f057d0dbda38ef710844
2019-02-20 11:01:52 -08:00
Kostia Balytskyi
33a83f729b replay: only expect timestamp and not timezone
Reviewed By: StanislavGlebik

Differential Revision: D14149972

fbshipit-source-id: 3cab55c9247fa06e3a01a5d4dda507d47a6ebf5e
2019-02-20 08:47:25 -08:00
Kostia Balytskyi
4a3a890f0d unbundlereplay: do not produce changegroup response part
Summary:
This is a perf optimization. `unbundlereplay.respondlightly` instructs the
server to not produce the pushback parts regardless of what `replycaps` part
of the incoming bundle says. This is important, since the mononoke-hg sync will
send all the bundles in a searialized way, so we want to optimize time where
possible.

Reviewed By: StanislavGlebik

Differential Revision: D14131575

fbshipit-source-id: afec15347d43fa52b1ec64b4ac8ece5b227ccf7d
2019-02-20 08:47:25 -08:00
Mark Thomas
590fbf957b pager: add config option to disable paging of stderr
Summary:
Add a `pager.stderr` config option that when set to false, disables the
redirection of stderr to the pager.

This means progress bars will be rendered, and other information will appear
synchronously, rather than buffered by the pager, but also that Mercurial will
start outputting stderr over the top of any output that the pager produces,
potentially corrupting the pager display.

Reviewed By: simpkins

Differential Revision: D14130965

fbshipit-source-id: eba8e31fdad05c935eae13e1900c5f7e5af7ecbc
2019-02-20 07:33:00 -08:00
Kostia Balytskyi
db51ee5121 bundle2: fix misleading function name
Summary: `reply` vs `replay`.

Reviewed By: StanislavGlebik

Differential Revision: D14131576

fbshipit-source-id: 2507968047ec8ff9ae14b961f2c90eb3d19f7f2a
2019-02-19 08:22:24 -08:00
Kostia Balytskyi
da3e429150 wireproto: add unbundlereplay command
Summary:
This is to be used from Mononoke->hg sync.
Currently expects only `pushrebase` bundles, e.g. one head and one book to
move.

Reviewed By: StanislavGlebik

Differential Revision: D14116130

fbshipit-source-id: 959a6e51f51e21da5592c84188e294a33057ffaa
2019-02-19 01:57:39 -08:00
Arun Kulshreshtha
9c6b914a22 types: move Key and NodeInfo out of revisionstore
Summary:
In order to move the types in `edenapi-types` (containing types shared between Mercurial and Mononoke) to the `types` crate, we need to move a few types from the  `revisionstore` crate into this crate first, because `revisionstore` depends on `types`, which would create a circular dependency since `edenapi-types` uses types from `revisionstore`.

In particular, this diff moves the `Key` and `NodeInfo` types into their own modules in the `types` crate.

Reviewed By: quark-zju

Differential Revision: D14114166

fbshipit-source-id: 8f9e78d610425faec9dc89ecc9e450651d24177a
2019-02-15 22:51:04 -08:00
Jun Wu
f752c4dd75 commands: deprecate "hg id -b"
Summary:
There are still users of "hg id -b", namely shell prompt scripts.
However, it seems fine to remove "branch" from the formatted (JSON or other
formats) output.

Reviewed By: ikostia

Differential Revision: D14076296

fbshipit-source-id: a77f4b9e73161d322da3f1bdec993082ac463939
2019-02-14 17:44:40 -08:00
Jun Wu
dc38aa9d7a commands: remove "clone --branch" flag
Differential Revision: D14076299

fbshipit-source-id: dafbb7866e12e551b162a20ee048264866b67c96
2019-02-14 17:44:40 -08:00
Jun Wu
e257757924 commands: remove "bundle --branch" flag
Summary: Named branches are going away.

Differential Revision: D14076297

fbshipit-source-id: b68356f7075a6a8787cf0d2aa972bb27e1ef9bb1
2019-02-14 17:44:40 -08:00
Jun Wu
37af1cfda3 commands: remove "commit --close-branch" flag
Summary: Without named branch, it is not meaningful to close a branch.

Differential Revision: D14076295

fbshipit-source-id: 527ae457cb14f9415fa7269b7dc123252e7d6867
2019-02-14 17:44:40 -08:00
Jun Wu
35a58e8c24 commands: replace "branch" command with deprecation warnings
Summary:
Unfortunately, there are still users of the "hg branch" command so we cannot
remove it right now. But I'm updating internal tools to not call it.

Reviewed By: ikostia

Differential Revision: D14076300

fbshipit-source-id: a5322d9c9ce8148c6ad0800653bd829736556386
2019-02-14 17:44:40 -08:00
Jun Wu
82b4be9a7f config: hard-code ui.allowbranches=False
Summary: Since it's always False, remove the config option.

Reviewed By: ikostia

Differential Revision: D14076304

fbshipit-source-id: 2cc6409355a0c4514a62bc764e1deec0af1bd3a1
2019-02-14 17:44:40 -08:00
Jun Wu
9a87d9567c commands: remove "branches" command
Summary:
It seems nobody uses it from dev_commands logging. Search for "allowbranches"
in all internal repos suggests nobody turned it on. The tests were also
migrated to not use the command so let's just remove it.

Reviewed By: ikostia

Differential Revision: D14076298

fbshipit-source-id: a1cb03b2da289c01b15f0580ffe77531941be213
2019-02-14 17:44:40 -08:00
Jun Wu
4801f88fad config: set ui.allowbranches to False by default
Summary: This would make the test runner run tests with named branch disabled.

Reviewed By: phillco

Differential Revision: D14059835

fbshipit-source-id: 9fbad5688bd8c69d32016b2ec1f931102638da68
2019-02-14 17:44:40 -08:00
Jun Wu
338fe1197f dirstate: add more logging to debug T39234759
Summary:
"st_size" returned by watchman is sometimes 0. We suspect it's incorrect.
It could be the file on disk is actually empty, or the kernel made it
look empty to watchman in the past, or there is something wrong with
serialization, etc. Let's first add a real os.stat to test if the file
is really empty.

Reviewed By: phillco

Differential Revision: D14090851

fbshipit-source-id: bd75cf86bfd117285658ad0dd7fb28d0e8b5585c
2019-02-14 16:29:46 -08:00
Phil Cohen
50ebbbbb86 hook: print exception message on load failure
Summary: Otherwise mergedrivers become impossible to debug if they don't import correctly.

Reviewed By: ikostia

Differential Revision: D14071200

fbshipit-source-id: 3e677089e6b008d892158290c392e1f9d68a67ae
2019-02-14 16:22:22 -08:00
Mateusz Kwapich
4f58ae8678 config: stop lying about the config locations
Summary:
Since september (D9840431) rcutil.rccomponents is no longer source of truth
about which config files we load. In fact we use it only in the
`hg config --debug`. This leads to situations where the debug command mentions
loading a specific config file and then ignores it completely which is very
confusing.

Let's remove it.

Reviewed By: suitingtseng

Differential Revision: D14083220

fbshipit-source-id: 362fd9bf574e24639f99a1203206184da42d1e24
2019-02-14 09:31:58 -08:00
Arun Kulshreshtha
575e570a28 bindings: move pyedenapi into bindings crate
Summary: Move the edenapi Python bindings into the common `bindings` crate.

Reviewed By: quark-zju

Differential Revision: D13963179

fbshipit-source-id: 76dead82af992615a9e452ee6fbb9f66639c822c
2019-02-13 16:07:00 -08:00
Arun Kulshreshtha
127ca1a990 edenapi: use rustls instead of openssl
Summary:
Switch from using OpenSSL (via `native-tls`) to [Rustls](https://github.com/ctz/rustls), a pure-Rust TLS implementation based on the `ring` crypto crate.

Unlike `native-tls`, Rustls supports ALPN, which means it can be used along with Hyper to perform HTTP/2 requests over TLS. (OpenSSL also supports ALPN, but older versions of Windows' `schannel` library do not, and as such `native-tls` doesn't support ALPN either regardless of platform.)

Rustls also builds on Windows without any special configuration, sidestepping the issues we've been having with OpenSSL in the Windows build.

Reviewed By: quark-zju

Differential Revision: D14070084

fbshipit-source-id: 25268c58a88177f4708370696d326b4c0bdc89a0
2019-02-13 16:07:00 -08:00
Arun Kulshreshtha
1d00a343e4 bindings: add init module
Summary:
Add a new `init` module to the `bindings` crate. This is intended as a place to put global Rust initialization code for Mercurial's Rust extensions. Ordinarily, such code would go at the start of `main()`, but since `hg` doesn't have a Rust main, putting initialization here at least guarantees that it will happen before any of the Rust extension code runs.

Right now, the only thing initialized in the new module is `env_logger`.

Reviewed By: quark-zju

Differential Revision: D14072560

fbshipit-source-id: 0f2770d0a3a6e9c6b7fe68eb62007cc091adad59
2019-02-13 16:07:00 -08:00
Jun Wu
8fd207a853 revset: stop supporting origin() and destination()
Summary: They will be replaced by successors and predecessors.

Reviewed By: singhsrb

Differential Revision: D14000097

fbshipit-source-id: 07f0c97edd7eb16ad665c00886c00212d516ae72
2019-02-12 21:45:11 -08:00
Jun Wu
fbccd19ed7 patchbomb: remove the extension
Summary:
`test-patchbomb.t` uses named branches and does not look simple to fix.
We don't use email patches internally, and it's not hard to write scripts
around `hg export`. Therefore drop the extension and its tests.

Reviewed By: singhsrb

Differential Revision: D13978577

fbshipit-source-id: 19867ae68c19c996bfce064eb2234705939db9ea
2019-02-12 21:45:10 -08:00
Jun Wu
64c43d2eab import: remove the --import-branch flag
Summary: Branches are going away.

Reviewed By: singhsrb

Differential Revision: D13978568

fbshipit-source-id: b9b4f3d2755757c0d3780bbb10c4579bf8d15fef
2019-02-12 19:54:31 -08:00
Jun Wu
f656af6866 encoding: alias cp65001 to utf-8 on Windows
Summary:
This back ports Yuya's patch from upstream:

  changeset:   443029011990c75c533ec0454fd0f5c1060d4690
  branch:      stable
  user:        Yuya Nishihara <yuya@tcha.org>
  date:        Sun, 01 Jul 2018 06:36:53 -0800

      encoding: alias cp65001 to utf-8 on Windows

      As far as I can tell, cp65001 is the Windows name for UTF-8. I don't know
      how different it is from the UTF-8, but Python 3 appears to have introduced
      new codec for cp65001, so the alias is enabled only for Python 2.

      https://bugs.python.org/issue13216

      This patch is untested, but hopefully fixes the following issue.

      https://bitbucket.org/tortoisehg/thg/issues/5127/

More context:
Windows 10 Build 17035 (November 2017) introduced a
"Use Unicode UTF-8 for worldwide language support" checkbox, which makes the
"A" flavored APIs use UTF-8 instead of some non-UTF-8 local encoding. With
that checkbox ticked, hg would crash in cmd.exe complaining
"LookupError: unknown encoding: cp65001"

{F150484107}

Reviewed By: phillco

Differential Revision: D14017361

fbshipit-source-id: a648b2a9bc341d796532c6fd2730c083402b3736
2019-02-11 09:16:02 -08:00
Jun Wu
b74ee0564d chg: make it incompatible with upstream chg server
Summary:
It would be massy if there are 2 chg servers running: one for fb hg, one for
upstream hg, and they share a same socket path.

Change socket path and the commandserver name so fb-hg chg can only talk to
fb-hg chg servers.

Reviewed By: markbt

Differential Revision: D13869319

fbshipit-source-id: f9d42af9bdfc542207f23c536b478fd5ef8d02a0
2019-02-08 16:12:53 -08:00
Jun Wu
c2ef481658 logexchange: delete the experimental component
Summary:
logexchange was a subset of remotenames, added by:

  changeset:   5a62910948d2d4bac5defe305d0ddb22f0fda549  D1547
  user:        Pulkit Goyal <7895pulkit@gmail.com>
  date:        Wed, 04 Oct 2017 10:32:02 -0800
  summary:     remotenames: move function to pull remotenames from the remoterepo to core

Since we use the full remotenames instead, remove logexchange and its test,
which depends on named branch.

Differential Revision: D13954458

fbshipit-source-id: d565c131100ef90f3cf69e9051643ac8e5846f0d
2019-02-07 18:17:18 -08:00
Aida Getoeva
baa9bab088 set ui.slash=True if HGPLAIN=1
Summary:
`hg status` should show slashes in filepaths standard for the diff format. Now it shows windows' backslash.

More details:
https://fb.workplace.com/groups/scm/permalink/1933867456662865/

Reviewed By: quark-zju

Differential Revision: D13944478

fbshipit-source-id: d34d2c6bc0b9966e1806e36668c21e8abfc83a02
2019-02-07 04:32:27 -08:00
Jun Wu
dbc9a9f3e6 fscap: mark "fuse.ntfs" (ntfs-3g) as not supporting symlinks
Summary: See D13964546 for context.

Reviewed By: DurhamG, ikostia

Differential Revision: D13982878

fbshipit-source-id: abce6f3c005b916cfb2e7a34276b99f9fcaa44b5
2019-02-06 18:34:30 -08:00
Jun Wu
89882201b0 posix: detect fuse.ntfs on Linux
Summary:
On linux, ask /proc/self/mountinfo for the block device information, and then
ask udev for the filesystem type. It works for block devices, and is what
util-linux tools like findmnt, lsblk do.

This detects ntfs-3g mounts of block devices as `fuse.ntfs`.

Reviewed By: DurhamG

Differential Revision: D13982877

fbshipit-source-id: eacea6a949b54d9a6483f2c55c437718eb89c243
2019-02-06 18:34:30 -08:00
Jun Wu
efba35645a osutil: detect fuse on Linux
Summary:
The constant is not exposed in linux/magic.h, perhaps because fuse is an
optional feature. It's unlikely to be changed. Define it so fuse fstype
can be detected.

Reviewed By: DurhamG

Differential Revision: D13969640

fbshipit-source-id: 5084bdacf193261a187a74546a82995f2dd2d7c6
2019-02-06 18:34:30 -08:00
Arun Kulshreshtha
8aaab173c0 bindings: convert to Rust 2018
Summary: Convert crate to Rust 2018.

Reviewed By: quark-zju

Differential Revision: D13963023

fbshipit-source-id: f81a1ecd505d3bdc70c41f5272f861fdd737a8fc
2019-02-05 21:22:48 -08:00
Arun Kulshreshtha
5f6998719e edenapi: add static builder() method to get a client Builder
Summary: In Rust it is typically more idiomatic to have a static method on a struct to produce a builder, since this means the builder doesn't need to be explicitly imported to construct a new instance of the struct.

Reviewed By: DurhamG

Differential Revision: D13925323

fbshipit-source-id: c06d5d42ba941dbbb2c619f9470e79fa23f35f68
2019-02-05 21:22:48 -08:00
Arun Kulshreshtha
70aff50986 edenapi: rename mononokeapi to edenapi
Summary: Rename Mononoke API to Eden API, per war room discussion.

Reviewed By: quark-zju

Differential Revision: D13908195

fbshipit-source-id: 94a2fe93f8a89d0c5e9b6a24939cc4760cfaade0
2019-02-05 21:22:48 -08:00
Arun Kulshreshtha
6eab7a5222 mononokeapi: use auth section for TLS configuration
Summary:
Use the hgrc auth section to configure HTTP data fetching. For example:

```
[mononoke-api]
enabled = true
url = https://mononoke-api.internal.tfbnw.net

[auth]
mononoke-api.prefix = mononoke-api.internal.tfbnw.net
mononoke-api.schemes = https
mononoke-api.key = /var/facebook/credentials/$USER/x509/$USER.pem
mononoke-api.cert = /var/facebook/credentials/$USER/x509/$USER.pem
```

Reviewed By: DurhamG

Differential Revision: D13907185

fbshipit-source-id: 3b607f25912a85438b56c4ea7ab9cfed91ab7e85
2019-02-05 21:22:48 -08:00
Jun Wu
eaebf8d02d commands: drop unnecessary "config(..., default=...)"
Summary:
The default value is specified in configitems.py. Remove the `default`
argument.

Reviewed By: phillco

Differential Revision: D13909730

fbshipit-source-id: ca45c63be7d48e04e71a6f5b3b682f625a3030f6
2019-02-05 20:36:03 -08:00
Jun Wu
50932456ad tests: drop experimental.single-head-per-branch feature
Summary:
This reverts the upstream changeset:

  changeset:   66ecde8a704d9fa92bd99720923524c4bd3f315b
  user:        Boris Feld <boris.feld@octobus.net>
  date:        Wed, 15 Nov 2017 18:52:42 -0800
  summary:     server: introduce a 'experimental.single-head-per-branch' option

Named branches are going to be removed. Remove experimental dependent feature.

Reviewed By: phillco

Differential Revision: D13909727

fbshipit-source-id: 3baf101e5a038b58bc01506826b631a2a58a7782
2019-02-05 20:36:03 -08:00
Jun Wu
eb0ce36ac2 util: make timer return constant on tests
Summary:
Lots of places use it to print some thing like "fetched x files in y seconds (1KB/s)".

In tests, these have to be manually replaced to "* (glob)" patterns.

This diff makes test output static without using globs. So `run-tests.py -i` would just fix things.

Reviewed By: phillco

Differential Revision: D13954456

fbshipit-source-id: d139c7c5e268d3bab562c266335d740986780924
2019-02-05 20:36:03 -08:00
Jun Wu
f8f8e3962a status: add a way to log more details about why hg thinks a file was modified
Summary:
We're seeing issues where a file show up as "M" while it isn't expected so. When
running "hg status" again, the file disappeared. Existing logs suggest that
watchman does not think anything has changed between the two "status" commands.
Therefore add more logs of the internals to try to get more insights.

Differential Revision: D13954209

fbshipit-source-id: 0b89a6da5e8702e707440ef2e1823eb4968c10be
2019-02-05 19:41:35 -08:00
Durham Goode
f3a5d55c2b changelog: cache commit files list
Summary:
During pushrebase there is code that says 'for each file, do some work
that involves listing the changed files'. Because we reparse the list each time,
this becomes n^2 behavior. Let's cache the list to avoid this.

Reviewed By: singhsrb

Differential Revision: D13944830

fbshipit-source-id: 4fd0dbf26b6cee9d0c01879cafb9837262f7afa0
2019-02-05 15:52:00 -08:00
Jun Wu
452e2bd5d6 commandserver: import mercurial.__version__ from the right place
Summary: It was moved to edenscm.

Reviewed By: singhsrb

Differential Revision: D13955193

fbshipit-source-id: 79ec1a314398813de4f686f104b17cda0f43a92d
2019-02-05 09:47:34 -08:00
Fatih Aydin
64bd91b7f4 commands: add option to disable the outgoing command
Summary: Extend the option to disable `incoming` to also disable `outgoing`.

Reviewed By: markbt

Differential Revision: D13877971

fbshipit-source-id: c4f994d536dda5db7c0e9f14656be48fc757c237
2019-02-04 14:25:27 -08:00
Fatih Aydin
7e7faeea81 commands: add option to disable the incoming command
Summary: In repositories which change quickly, the incoming and outgoing commands aren't useful.  Add an option to disable these commands.

Reviewed By: markbt

Differential Revision: D13859604

fbshipit-source-id: c4784b7eafbe3c4a6cf03686f1431204089b0155
2019-02-04 07:09:37 -08:00
Mark Thomas
ae0a81f2c2 rust: move bindings to a single python extension
Summary:
Move all Rust bindings to a single python extension, `bindings`.  This should
improve compilation time and make things simpler.

Reviewed By: quark-zju

Differential Revision: D13923866

fbshipit-source-id: 560592b5a6c0c4f1b836c755ef123666a1059164
2019-02-01 17:53:22 -08:00
Saurabh Singh
1752853929 commit: remove option to specify secret phase
Summary:
We will probably not be supporting secret phase in the future anyway
so lets get rid of it.

Reviewed By: quark-zju

Differential Revision: D13928907

fbshipit-source-id: 7edcd84d2ee3c37124dcf9d3ba92c0610d074157
2019-02-01 15:36:44 -08:00
Arun Kulshreshtha
50c293b94e pymononokeapi: add Python API for batch file downloads
Summary: Expose `MononokeClient`'s multi-get functionality through the Python bindings using a builder-style API.

Differential Revision: D13893748

fbshipit-source-id: 312e7449eb8300432b1f1de28e0c6fc3e47d1d53
2019-02-01 01:41:31 -08:00
Arun Kulshreshtha
f02ebcffb7 mononokeapi: support fetching multiple files concurrently
Summary: Give MononokeClient the ability to fetch multiple files concurrently. Right now this functionality is not exposed via the Python bindings, so as far as the Mercurial Python code is concerned, nothing has changed. The multi-get functionality will be used later in the stack.

Differential Revision: D13893575

fbshipit-source-id: c9e514fbeb41bbb37f52f6df3920eb01a66df293
2019-02-01 01:41:31 -08:00
Arun Kulshreshtha
1b74af2ace mononokeapi: add ability to fetch a file and write it to a datapack
Summary: Add a new `get_file()` method to `MononokeClient` that fetches Mercurial file content from the API server and writes it to a datapack in the cache. This functionality is exposed via the new `hg debuggetfile` debug command, which takes a filenode and file path and fetches the corresponding file.

Differential Revision: D13889829

fbshipit-source-id: 2b68bf114ee72d641de7a1043cca1975e34cf4e6
2019-02-01 01:41:31 -08:00
Jun Wu
9dc21f8d0b codemod: import from the edenscm package
Summary:
D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`.
That has nasty problems if both `import mercurial` and
`import edenscm.mercurial` are used, because Python would think `mercurial.foo`
and `edenscm.mercurial.foo` are different modules so code like
`try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)`
would fail to handle the `edenscm.mercurial` version. There are also some
module-level states (ex. `extensions._extensions`) that would cause trouble if
they have multiple versions in a single process.

Change imports to use the `edenscm` so ideally the `mercurial` is no longer
imported at all. Add checks in extensions.py to catch unexpected extensions
importing modules from the old (wrong) locations when running tests.

Reviewed By: phillco

Differential Revision: D13868981

fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
2019-01-29 17:25:32 -08:00
Adam Simpkins
043e2016ac fix some additional edenscm name changes
Summary:
Follow up to D13853115 to fix test failures:
- Update an `__import__` statement in dispatch.py to use the new
  `edenscm.mercurial` package path.
- Make sure the `__version__.py` file is generated at the correct location by
  the buck build files.

Reviewed By: quark-zju

Differential Revision: D13858016

fbshipit-source-id: 54ac4a02274cf921397932e9625f422c5f427623
2019-01-29 12:26:10 -08:00
Kostia Balytskyi
401eff3cda bundle2: fix debugging output for input parts
Reviewed By: quark-zju

Differential Revision: D13819208

fbshipit-source-id: 373d9669395a08f46e5801f822486ba2f10fd36b
2019-01-28 21:47:17 -08:00
Jun Wu
c12e300bb8 codemod: move Python packages to edenscm
Summary:
Move top-level Python packages `mercurial`, `hgext` and `hgdemandimport` to
a new top-level package `edenscm`. This allows the Python packages provided by
the upstream Mercurial to be installed side-by-side.

To maintain compatibility, `edenscm/` gets added to `sys.path` in
`mercurial/__init__.py`.

Reviewed By: phillco, ikostia

Differential Revision: D13853115

fbshipit-source-id: b296b0673dc54c61ef6a591ebc687057ff53b22e
2019-01-28 18:35:41 -08:00