Commit Graph

46370 Commits

Author SHA1 Message Date
Xavier Deguillard
334e0c0c2e remotefilelog: the rust mutable stores are the default
Summary: This is now enabled for the entire fleet, let's hardcode this in the code now.

Reviewed By: kulshrax

Differential Revision: D16392289

fbshipit-source-id: 462152ded12d00cf8218526d51a911d6fe5975ca
2019-07-24 10:34:30 -07:00
George-Catalin Tintareanu
15f36ceede hg client handler for blacklisted files
Summary: Checks if the retrieved content of a file is equal to a `magic string` representing a blacklisted file. If so, then the content is replaced by a readable text which suggests a `rebase` or `update` to a newer commit.

Reviewed By: ikostia

Differential Revision: D16260011

fbshipit-source-id: ac1d40132b9c947927271d8e6efda98b19dce984
2019-07-24 03:41:20 -07:00
Arun Kulshreshtha
a491bb06ea remotefilelog: only print debug messages during interactive usage
Summary: The debug messages from Eden API provide Source Control team members with useful diagnostic information about HTTP data fetching, but they have the potential to be spammy when written to log files. To prevent log spam, let's only print these messages during interactive usage.

Reviewed By: quark-zju

Differential Revision: D16445346

fbshipit-source-id: 001dc75e440eaf797f4f953648453086421f624e
2019-07-23 15:13:59 -07:00
Zeyi (Rice) Fan
a62bf843cf Back out "RFC: hg: make zsh completion to return list of draft commits"
Summary:
Original commit changeset: 3493895a12ae

This is breaking `arc pull` in fbsource S183062

 #commitClose

Reviewed By: mitrandir77, singhsrb, xavierd

Differential Revision: D16441944

fbshipit-source-id: fd3f5c7027be1468bd8194e6b24dd136b9b767d2
2019-07-23 13:07:14 -07:00
Mark Thomas
d384df8a35 setup.py: always copy library files from fbsource
Summary:
The `fbsourcepylibrary` class only copies the source files if the destination
directory does not exist.  Once the files have been copied, subsequent builds
will not pick up new versions.  This means builds can be stale.

Remove the special case of `_isready`.  This will fall back to the default
implementation which will copy the files each time the build happens.

Reviewed By: quark-zju

Differential Revision: D16438778

fbshipit-source-id: 66dc0b69b427650087cfb822acdbf1fc797babbc
2019-07-23 11:01:08 -07:00
Xavier Deguillard
7478874389 remotefilelog: remove maintenance repack memcache fetch
Summary:
When using fetchpacks, memcache will write to an indexedlog, which can't be
repacked. I'm also suspecting that there is a race between this repack, and
hg_memcache_client opening the newly created packfiles which can cause the
misses to not be sent to memcache.

Reviewed By: kulshrax

Differential Revision: D16432538

fbshipit-source-id: 62362682474883bcd58249791c02b9fed5cb8fea
2019-07-22 22:31:38 -07:00
Shu-Ting Tseng
5c49bedd8b add a trailing newline when committing to svn
Summary:
By adding a newline, we can ensure the meta message is always on its own line.

This is to address the comment in D16340374.

link to comment: https://our.intern.facebook.com/intern/diff/D16340374/?transaction_id=732272950561759&src_number=86745022

Reviewed By: quark-zju

Differential Revision: D16417344

fbshipit-source-id: caaae1748018bbe5ddbb587adacd45b8709da8cc
2019-07-22 14:06:12 -07:00
Stefan Filip
7c511ba610 manifest: add matcher filtering to the files iterator
Summary:
Most operations do not work on iterate on all the files of the repository.
Most operations filter the data set in some way. In many cases this filtering
is to a set of files and in some cases using patterns or subdirectories.

The Python code uses `match.py` to represent this filtering. The parallel
data structure in the rust code is `pathmatcher::Matcher`.

This diff adds `files` integration with `pathmatcher::Matcher`.

Reviewed By: quark-zju

Differential Revision: D16352527

fbshipit-source-id: 8b61ac7399f581773bf61ff648634cbc6e1a27b6
2019-07-22 13:03:02 -07:00
Stefan Filip
3bb2fa1efb bindings: add Macher implementation for PyObj
Summary:
This allows us to use python matcher objects in rust. Particularly we are
looking at using these in the manifest implementation for filtering the
file set that is returned.

Reviewed By: quark-zju

Differential Revision: D16352533

fbshipit-source-id: fd6bde6d9223203c69593d5e8830946170363243
2019-07-22 13:03:01 -07:00
Stefan Filip
e05693d74b manifest: move file description code from lib.rs to file.rs
Summary:
Title. Small clean up. I think that this makes sense because the code in
file.rs is self contained. It provides a distraction free environment for
adding methods to the structures in there.

Reviewed By: quark-zju

Differential Revision: D16352531

fbshipit-source-id: c23e943198e0a4b50aa00c75e67b13bc4c3ee976
2019-07-22 13:03:01 -07:00
Stefan Filip
75fd92d1a2 pathmatcher: add Matcher trait
Summary:
"matcher.py" is used in several places where the the file tree is traversed.
We need to use implement the matcher functionality in the Rust manifest
implementation. We define a common type to be used in our internal code.

In our current state of interfacing a lot with Python, fast paths of matching
full trees is useful so we have 3 states for matching a directory:
 * everything in the directory subtree should be returned
 * nothing in the directory subtree should be returned
 * another state where there is no fast path and the directory should be
 traversed recusively; this state is always valid to return and doe not
 impact correctness

The interface for the Matcher is defined in relationship to RepoPath. We store
paths internally in the same binary format no matter the operating system path
representation. Using std::path would incur a translation cost.

Reviewed By: quark-zju

Differential Revision: D16352528

fbshipit-source-id: 61b259f4347cfaf6f74ee36fa5955e45e4beb739
2019-07-22 13:03:00 -07:00
Stefan Filip
cb57f5d7ac bindings: add manifest python classes
Summary: Bindings so that the rust manifest code can be used in Python.

Reviewed By: quark-zju

Differential Revision: D16352532

fbshipit-source-id: 34d4522f5e084f531f31bcd21770950f15f2fe13
2019-07-22 13:03:00 -07:00
Stefan Filip
69b604e3ec pyrevisionstore: remove unsafe impl Send for PythonDataStore
Summary:
https://doc.rust-lang.org/nomicon/send-and-sync.html
http://dgrunwald.github.io/rust-cpython/doc/cpython/struct.PyObject.html

PyObject implements Send. Because Send is automatically derived when composed
of structures that are Send, PythonDataStore is Send. Similarly
PythonMutableDataPack is Send without the explicit marker.

Reviewed By: xavierd

Differential Revision: D16352526

fbshipit-source-id: cbf9305fcc369716cafcc8adfdf35fd0a9e1fddc
2019-07-22 13:02:59 -07:00
Stefan Filip
414bba325e types: add String/str conversions for RepoPath & friends
Summary:
In cross language code it is useful to convert to a String before giving the
object up. Without this method we would have to copy the string before dropping
the current object. This method provides an efficient method for getting the
String from RepoPath objects.
str conversions show up in similar places places.

Reviewed By: quark-zju

Differential Revision: D16352530

fbshipit-source-id: 159f522d0c19287aed29b8cce99c1675b5d801fc
2019-07-22 13:02:59 -07:00
Stefan Filip
a1a75d5d73 tremanifest: rename tree holding variable to _tree
Summary: Minor rename

Reviewed By: quark-zju

Differential Revision: D16352529

fbshipit-source-id: 658f9843041d858e1471c07554b5715db011d17c
2019-07-22 13:02:58 -07:00
Jared Bosco
089e77642a dispatch: replace final fancyopts call with native rust
Summary: Remove final fancyopts call to have all python parsing being done through native rust codepath, as well as clean-up some deprecated flags that would be special handling.

Reviewed By: quark-zju

Differential Revision: D16156284

fbshipit-source-id: ec5ccaeb982c78426e12ff1d7342b4ea6653e98e
2019-07-20 01:06:35 -07:00
Jared Bosco
f56b7f2a62 cliparser: add more robust error handling for parsing failure cases
Summary: Add errors and map them to python exceptions to emulate the original python error handling behavior.

Reviewed By: quark-zju

Differential Revision: D16136571

fbshipit-source-id: eb999162cad040566e30b460f2b873efb05fc67a
2019-07-20 01:06:35 -07:00
Jared Bosco
939b3f5c57 cliparser: change FlagDefinition to use Cow to support static and dynamic lifetimes
Summary: To support 'static and dynamic lifetimes the FlagDefinition will have a Cow<'a, str> allowing the API to remain the same and still be used with strings passed from python.

Reviewed By: quark-zju

Differential Revision: D16136148

fbshipit-source-id: 670925549919a0965287b264704150f6ab638a18
2019-07-20 01:06:35 -07:00
Jared Bosco
93949f4629 dispatch: replace alias expansion and fancyopts parsing call with native rust
Summary:
Replace the second to last fancyopts call with pure rust code parsing and error handling.

Make slightly nicer help messages for ambiguous commands instead of just saying every possible command possible.

Reviewed By: quark-zju

Differential Revision: D16063049

fbshipit-source-id: bfd9e58649b1de2d3485069ce8d5646927bc77f4
2019-07-20 01:06:34 -07:00
Jared Bosco
252931cc73 bindings: expose native alias expansion to the python world
Summary: Expose the alias expansion native rust code to the Python code to be able to utilize the earlier alias expansion as well as custom Rust errors.

Reviewed By: quark-zju

Differential Revision: D16063040

fbshipit-source-id: 58cd8c9f16e07687545ebf19332b32fce8db278d
2019-07-20 01:06:34 -07:00
Jared Bosco
ae89e32851 cliparser: expose method to perform alias expansion on arguments
Summary:
Alias expansion originally occurs in mercurial through a chain of command handlers that point at their alias.

Now, aliases can be fully expanded early on into parsing to only resolve actual commands and not have to follow a chain of executions.

Reviewed By: quark-zju

Differential Revision: D16059122

fbshipit-source-id: cf28fba4a131ab29ceda87bc3e90d7a434e06625
2019-07-20 01:06:34 -07:00
Jared Bosco
137edc1814 rustshlex: add external source code for posix-style parsing
Summary: Very small library ( one file ) that allows for posix-style splitting.  The library was not vendored in third-party and therefore was just added to unblock as fast as possible.

Reviewed By: quark-zju

Differential Revision: D15911319

fbshipit-source-id: 2820d5beb5b3493a507f00f4b94e93b0405cf991
2019-07-20 01:06:34 -07:00
Jared Bosco
5f02e5cd5c dispatch: replace _parse's call to fancyopts with native code
Summary: Replacing another fancyopts call to be parsed by native Rust code.  This diff introduces slightly hacky feeling behavior in order to handle cycles and resolving aliases, but will be fixed in a follow-up diff where Rust will fully expand the aliases completely removing the need for this confusing alias resolving, chaining, and execution.

Reviewed By: quark-zju

Differential Revision: D15902758

fbshipit-source-id: 11d9a479989a23de09bf96f8020d2fded6c06351
2019-07-20 01:06:33 -07:00
Jared Bosco
3c30d27350 copytrace: remove copytrace flag from mutating global options table
Summary:
Copytrace modified the global definitions table which was making it very difficult to keep track of side-effects as the code was executed, as well as making it harder to replace the fancyopts calls with native Rust.

Since the copytrace behavior can be achieved through a configuration, it now will no longer modify the global definitions table, and will display the correct flag for a user to use in order to get this same behavior.

Reviewed By: quark-zju

Differential Revision: D15902449

fbshipit-source-id: 1c254162d56823e65085b7047bb37513f187b487
2019-07-20 01:06:33 -07:00
Jared Bosco
40ca990aac dispatch: replace a fancyopts call with native code
Summary: Replace the next usage of fancyopts in dispatch.py with native rust code, and ensure all tests pass with this replacement.

Reviewed By: quark-zju

Differential Revision: D15857997

fbshipit-source-id: ec8722bfe661731a14cb324e97846f861bd60bc8
2019-07-20 01:06:33 -07:00
Jared Bosco
ee1fcc3d2d bindings: create cliparser native binding to replace fancyopts early parsing
Summary:
The current Python parsing library fancyopts does an early parse for global flags, as well as slightly different logic for parsing out flags.

Switching this fancyopts call should allow fancyopts to be completely replaced by the native code path, and start using Rust parsing for hg.

This enforces command line arguments to be utf8. At Facebook, our `hg` wrapper already crashes if that is not the case. So it shouldn't cause new issues.

Reviewed By: quark-zju

Differential Revision: D15837079

fbshipit-source-id: 95634ebc814f8865960181f23282e5283068057c
2019-07-20 01:06:32 -07:00
Jared Bosco
95b0be5bdc dispatch: remove strictflags and related tests
Reviewed By: quark-zju

Differential Revision: D15833690

fbshipit-source-id: 3469d8def660b116c0f82c674a19f06b18f29211
2019-07-20 01:06:32 -07:00
Jared Bosco
9984985969 cliparser: port python global flags to rust definition
Summary: The global flags currently in Python should be ported to Rust definitions

Reviewed By: quark-zju

Differential Revision: D15782273

fbshipit-source-id: 1cfdb3bbab946d18dc3c899163286e30fa69c2c7
2019-07-20 01:06:32 -07:00
Jared Bosco
b41f91b70d cliparser: allow flags to be partial matched by prefix
Summary:
Flags should be able to be matched partially by a prefix-match.

If a given prefix returns more than one possible Flag, it is therefore ambiguous and should not choose for the user.

An exact match should always take precedence.  A partial match should be tried in the event the argument is not an exact match.

Reviewed By: quark-zju

Differential Revision: D15749936

fbshipit-source-id: 26e699616a1b3fa6871fb50cc6914f916701004c
2019-07-20 01:06:32 -07:00
Jared Bosco
ef61b6fae9 cliparser: add skeleton code for command and command builder
Summary: Initial design / skeleton code for command::Command and command::CommandBuilder which is unimplemented

Reviewed By: quark-zju

Differential Revision: D15588927

fbshipit-source-id: 193d3d2aaae98a252e13d5b1e655cf93d7ce801e
2019-07-20 01:06:31 -07:00
Xavier Deguillard
8f47102275 fixcorrupt: fix debugfixcorrupt on treeonly repos
Summary:
Treeonly repos doesn't use revlogs, and thus debugfixcorrupt shouldn't try to
fix them.

Reviewed By: quark-zju

Differential Revision: D16373142

fbshipit-source-id: 6517b9516358223bfb6c646fd22aaa99c26b0372
2019-07-19 20:15:36 -07:00
Jun Wu
32b2b5a44e bindings: replace PyResult<String> with PyResult<Bytes>
Summary: This makes sure bytes (Python 2 `str`) is returned as expected.

Reviewed By: xavierd

Differential Revision: D16399693

fbshipit-source-id: c299933cfb5ec57bb46fed1f30a9ad07aa043703
2019-07-19 19:57:18 -07:00
Jun Wu
56134dd739 cpython-ext: add a Bytes type
Summary:
The `rust-cpython` library tries to be smart about `String` -> `PyObject` convertion.
It creates a unicode object if string is non-ascii:

  impl PyString {
      ...
      pub fn new(py: Python, s: &str) -> PyString {
          #[cfg(feature="python27-sys")]
          fn new_impl(py: Python, s: &str) -> PyString {
              if s.is_ascii() {
                  PyBytes::new(py, s.as_bytes()).into_basestring()
              } else {
                  PyUnicode::new(py, s).into_basestring()
              }
          }
          ...
      }
      ...
  }

In hg's case, we almost always want Python 2 bytes and never unicode objects.
Provide a new type for that.

Reviewed By: xavierd

Differential Revision: D16399345

fbshipit-source-id: cf47906ea3c871bcd1289239167241dcc3fedd8d
2019-07-19 19:57:18 -07:00
Jun Wu
c2027cc740 test-revset-age: migrate to Python and stablize it
Summary:
The test was flaky:

  --- test-revset-age.t
  +++ test-revset-age.t.err
  @@ -13,7 +13,6 @@

   Check age ranges
     $ hg log -T '{rev} {desc}\n' -r 'age("<30")'
  -  5 Changeset 5 seconds ago
     $ hg log -T '{rev} {desc}\n' -r 'age("<7m30s")'
     4 Changeset 420 seconds ago
     5 Changeset 5 seconds ago
  @@ -22,7 +21,6 @@
     4 Changeset 420 seconds ago
     5 Changeset 5 seconds ago
     $ hg log -T '{rev} {desc}\n' -r 'age("<1d")'
  -  2 Changeset 86369 seconds ago
     3 Changeset 3800 seconds ago
     4 Changeset 420 seconds ago
     5 Changeset 5 seconds ago
  @@ -53,10 +51,10 @@
     $ hg log -T '{rev} {desc}\n' -r 'age(">1d")'
     0 Changeset 31536000 seconds ago
     1 Changeset 86401 seconds ago
  +  2 Changeset 86369 seconds ago
     $ hg log -T '{rev} {desc}\n' -r 'age(">365d")'
     0 Changeset 31536000 seconds ago
     $ hg log -T '{rev} {desc}\n' -r 'age("<64m")'
  -  3 Changeset 3800 seconds ago
     4 Changeset 420 seconds ago
     5 Changeset 5 seconds ago
     $ hg log -T '{rev} {desc}\n' -r 'age("<60m500s")'
  @@ -87,16 +85,16 @@
     hg: parse error: invalid age in age range: 5h-10d
     [255]
     $ hg log -T '{rev} {desc}\n' -r 'ancestorsaged(., "<1d")'
  -  2 Changeset 86369 seconds ago
     3 Changeset 3800 seconds ago
     4 Changeset 420 seconds ago
     5 Changeset 5 seconds ago
     $ hg log -T '{rev} {desc}\n' -r 'ancestorsaged(.^, "<1d")'
  -  2 Changeset 86369 seconds ago
     3 Changeset 3800 seconds ago
     4 Changeset 420 seconds ago
     $ hg log -T '{rev} {desc}\n' -r 'ancestorsaged(., "1d-20d")'
     1 Changeset 86401 seconds ago
  +  2 Changeset 86369 seconds ago
     $ hg log -T '{rev} {desc}\n' -r 'ancestorsaged(., ">1d")'
     0 Changeset 31536000 seconds ago
     1 Changeset 86401 seconds ago
  +  2 Changeset 86369 seconds ago

Translate it to Python and patch `time.time` to stablize it.

Reviewed By: xavierd

Differential Revision: D16396479

fbshipit-source-id: 553bfe36094b2a2cbe939319606a627323cfc9eb
2019-07-19 19:36:33 -07:00
Jun Wu
3f21de52f4 test-fb-hgext-remotefilelog-local: try to make it less flaky
Summary:
The test was flaky:

  --- test-fb-hgext-remotefilelog-local.t
  +++ test-fb-hgext-remotefilelog-local.t.err
  @@ -31,7 +31,6 @@
     M x
     M y
     ? a
  -  1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over 0.00s
     $ hg add a
     $ hg status
     M x

Reviewed By: xavierd

Differential Revision: D16393051

fbshipit-source-id: 3dad1970200388b8339bc2e73b7a092336edc70d
2019-07-19 19:36:33 -07:00
Jun Wu
a77e9a4d5a test-fb-hgext-remotefilelog-bgprefetch: try to make it less flaky
Summary:
The test was flaky:

  --- test-fb-hgext-remotefilelog-bgprefetch.t
  +++ test-fb-hgext-remotefilelog-bgprefetch.t.err
  @@ -211,7 +211,6 @@
     $ find $CACHEDIR -type f | sort
     $ echo b > b
     $ hg commit -qAm b
  -  * files fetched over 1 fetches - (* misses, 0.00% hit ratio) over *s (glob)
     $ hg bookmark temporary
     $ sleep 1
     $ hg debugwaitonprefetch >/dev/null 2>%1
  @@ -266,7 +265,7 @@
     $ hg rebase -s temporary -d foo
     rebasing 3:58147a5b5242 "b" (temporary tip)
     saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/58147a5b5242-c3678817-rebase.hg (glob)
  -  3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over *s (glob)
  +  2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over 0.00s
     $ sleep 1
     $ hg debugwaitonprefetch >/dev/null 2>%1
     $ sleep 1

Reviewed By: xavierd

Differential Revision: D16393049

fbshipit-source-id: fb558e9c7f9cc51b1b133471220ac4862b985098
2019-07-19 19:36:32 -07:00
Jun Wu
b785df33a4 test-shelve: try to make it less flaky
Summary:
`...s ago` is flaky.

    --- test-shelve.t
    +++ test-shelve.t.err
    @@ -885,7 +885,7 @@
       +patch a
     No-argument --patch should also work
       $ hg shelve --patch
    -  default-01      (*s ago)    shelve changes to: create conflict (glob)
    +  default-01      (15s ago)   shelve changes to: create conflict

       diff --git a/shelf-patch-b b/shelf-patch-b
       new file mode 100644

Reviewed By: xavierd

Differential Revision: D16393050

fbshipit-source-id: 3906eabfd7ba9e4b11e7c4c8f236324afc607fff
2019-07-19 19:36:32 -07:00
Jun Wu
fa23fa1a77 test-fb-hgext-treemanifest-prefetch: try to make it less flaky
Summary:
`sleep ...` makes test flaky.

   --- test-fb-hgext-treemanifest-prefetch.t
   +++ test-fb-hgext-treemanifest-prefetch.t.remotefilelog.true.shallowrepo.false.err
   @@ -554,7 +554,7 @@
      $ sleep 1
      $ hg debugwaitonrepack
      $ ls_l $CACHEDIR/master/packs/manifests | grep datapack | wc -l
   -  \s*1 (re)
   +  3
    #endif

Reviewed By: xavierd

Differential Revision: D16391376

fbshipit-source-id: 3dc1ee3d1c8b85bc6b0a58570443b89aef86f55a
2019-07-19 19:36:32 -07:00
Adam Simpkins
40d7b50dfb rename the eden thrift wrapper library to match the python namespace
Summary:
We install the python files under `eden/fs/service` in a package named
`eden/thrift` in the built python binaries that use these modules.  This
moves the source files into an `eden/thrift` subdirectory so that the source
directory layout more closely matches the final binary layout.

This will make it easier to run several of Eden's Python-based tools directly
from the source tree, without having to do as much directory layout
transformation.  This is particularly helpful on platforms like Windows, which
don't currently have an equivalent of "live PARs" which can be run from the
source tree without requiring a rebuild after each file edit.

Reviewed By: chadaustin

Differential Revision: D16354622

fbshipit-source-id: 4b58cc96451b1ee5441714aaf74f5e3b6ada9eaa
2019-07-19 15:29:25 -07:00
Adam Simpkins
3fc6ecfa81 rename the eden/dirstate.py module to match the python namespace
Summary:
We install `eden/py/dirstate.py` as `eden/dirstate.py` in built python
binaries that use this module.  This  moves the source file into an `eden/`
subdirectory so that the source directory layout more closely matches the
final binary layout.

This will make it easier to run several of Eden's Python-based tools directly
from the source tree, without having to do as much directory layout
transformation.  This is particularly helpful on platforms like Windows, which
don't currently have an equivalent of "live PARs" which can be run from the
source tree without requiring a rebuild after each file edit.

Reviewed By: chadaustin

Differential Revision: D16354627

fbshipit-source-id: 578748e76b730db33cf3ea555df48aa94d15019f
2019-07-19 15:29:25 -07:00
Jun Wu
237846d4ca tests: try to make build_nupkg.py test work
Summary:
build_nupkg.py test will copy tests/ to build/embedded/tests/ before running
them. That breaks testutil.dott "edenscm" module discovery. Try to fix it by
making "edenscm" module discovery consider "build/embedded/python27.zip".

Reviewed By: xavierd

Differential Revision: D16383017

fbshipit-source-id: 52e19182d3e5e7267221244bd39d9a146928d8df
2019-07-19 15:08:17 -07:00
Jun Wu
bc191c2aa5 test-dirstate-completion: fix the test
Summary: Avoid creating the same repo.

Reviewed By: xavierd

Differential Revision: D16381413

fbshipit-source-id: 9f1d6bee685af5cec26e40e7669ef794ce6b23ce
2019-07-19 13:27:08 -07:00
Xavier Deguillard
f0a2127ace tests: remove newly added flaky test in test-hgsubversion-push-command.py
Summary: This newly added test keeps failing. Let's remove it from now.

Reviewed By: DurhamG

Differential Revision: D16381346

fbshipit-source-id: 11146d44fbbcd1e1c960fe4a0b6e3c28854f456d
2019-07-19 13:09:23 -07:00
Matt Glazar
9b88f1e59b Fix slow rebase for commits which move files
Summary:
When rebasing or showing a diff for a commit which moved files, remotefilectx.ancestors (called by _tracefile) calculates the linkrev for each ancestor. Sometimes [1], this is a disaster:

* remotefilectx._linkrev executes its slow path and scans the change log.
* For each entry in the change log, remotefilectx._linkrev downloads trees if needed.
* Hg downloads trees one-by-one (as of D15964145).

remotefilectx.ancestors is only calculating linkrevs so it can sort the ancestors topologically. _tracefile only needs the ancestors to be ordered topologically, not by linkrev. remotefilectx.ancestors's calls to remotefilectx._linkrev are redundant.

Optimize _tracefile's use of remotefilectx.ancestors: order remotefilectx objects topologically (breadth-first) without sorting by linkrev. Create a new function for this purpose (topological_ancestors) to avoid possibly breaking other callers of remotefilectx.ancestors. As a side effect, make this new function return remotefilectx objects lazily, similar to the filectx.ancestors function.

On my machine, with warm caches, this speeds up 'hg diff -c' and 'hg rebase' for a modestly-sized commit. 'hg diff -c' takes 0.64 seconds, down from 65.6 seconds.

[1] Hypothesis: After 'hg amend', 'hg bundle' packages linkrevs which refer to the pre-amend commit (which is not serialized into the bundle) rather than the post-amend commit. 'hg unbundle' thus creates linkrevs referring to a missing commit.

Reviewed By: DurhamG

Differential Revision: D16297426

fbshipit-source-id: 407597d5e36fc06b33719c28f5ea5052e01dc7a3
2019-07-19 12:35:22 -07:00
Xavier Deguillard
ec9ec06360 run-tests: add testpilot test runner
Summary:
Testpilot can give us a lot of things for free, including the automatic
detection of flaky tests, disabling of them, re-enabling too, easy retries on
failure, timeouts, better tracking, and the list goes on.

At a first step, I'd like to make the testpilot runner the default in hgbuild
to get all the benefits listed above.

Reviewed By: quark-zju

Differential Revision: D16294182

fbshipit-source-id: aadfbac9eb05e9d64336daba7a50a6263e38c162
2019-07-19 11:47:04 -07:00
Xavier Deguillard
9151a3cc24 tests: fix test-run-tests.t
Summary: When all tests are skipped, run-tests.py no longer return a 80 error code.

Reviewed By: singhsrb

Differential Revision: D16380129

fbshipit-source-id: e84a3558df8c2c4ebef9a382a1172d859a47e220
2019-07-19 11:39:56 -07:00
Aida Getoeva
1fb44ce297 remotenames: disable selectivepull on clone
Summary:
Streaming clone works only if we fetch all data from the server, however with selective pull feature hg specifies the particular heads it needs to pull. It causes downgrade in clone performance.
I decided to disable selective pull just before the clone operation, so the feature will be working everywhere else. Also I still store, even after clone, only "subscribed" remote bookmarks.

There are, however, artifacts of such behaviour, they are shown by changes in `test-commitcloud-sync-remote-bookmarks.t`: the whole tree of commits now is available locally, except of the remote bookmarks.

Reviewed By: simpkins

Differential Revision: D16223458

fbshipit-source-id: 0564ac23a16fe54d245e0a6ce9db5be4b6e3532f
2019-07-19 10:04:26 -07:00
Aida Getoeva
3c81066860 commitcloud: fix sync when remotebooks sync disabled on one of the copies
Summary:
If one of the repo checkouts doesn't have remote bookmarks synchronization enabled, it must not affect the Cloud's remote bookmarks state.

I also changed `localserver` (is used for our tests) because Commit Cloud server deletes the "old" bookmark names from the db and inserts "new". However, the `localserver` just set the "new" books dictionary as a new state, which is not quite correct.

Reviewed By: simpkins

Differential Revision: D16338257

fbshipit-source-id: d77d9218b1c35ea1a097bbe7393d0910ce7b4d38
2019-07-19 10:04:25 -07:00
Aida Getoeva
6ab4fcf8f8 commitcloud: fix remote bookmarks' merge on sync
Summary: While checking if one public commit is an ancestor of another public commit, I used string hashes instead of binary nodes. Fixing.

Reviewed By: farnz

Differential Revision: D16338256

fbshipit-source-id: e27ed8d79ec9ed3a188cdee93366ab2f96526152
2019-07-19 10:04:25 -07:00
Zeyi (Rice) Fan
e2655fac28 RFC: hg: make zsh completion to return list of draft commits
Summary:
By default the zsh completion will give me a list of bookmark names which personally I don't think it is useful at all.

I think making it giving me the list of draft commits is much better.

Reviewed By: quark-zju

Differential Revision: D16094724

fbshipit-source-id: 3493895a12ae02df011560b53dd5e55c8d183c79
2019-07-18 22:26:01 -07:00