Commit Graph

44650 Commits

Author SHA1 Message Date
Marla Azriel
96cb1050bc commands: update help summary text
Summary: Updated the global help summaries that are displayed for each command when you run 'hg help' and fixed corresponding tests

Reviewed By: markbt, kulshrax

Differential Revision: D12832280

fbshipit-source-id: 950dad1c805feab573d7d0182da523ae12299d3b
2018-11-07 19:59:47 -08:00
Jun Wu
4401ea1473 tests: add a test showing sparse issues
Summary: There are multiple issues here. Expose them.

Reviewed By: DurhamG

Differential Revision: D10861608

fbshipit-source-id: 5e55e4550574b0955eec92b70c700599eebccc6e
2018-11-07 16:36:41 -08:00
Kostia Balytskyi
825a9ddee5 windows: implement a more atomic rename/replace
Summary:
Our `rename` is not atomic:
```
def rename(src, dst):
    """Rename file src to dst, replacing dst if it exists"""
    try:
        os.rename(src, dst)
    except OSError as e:
        if e.errno != errno.EEXIST:
            raise
        unlink(dst)
        # What if the process is interrupted here?
        os.rename(src, dst)
```

However, the `MoveFileEx` Windows API provides a way to to
replace the existing file, thus eliminating the need to do `unlink`.

Unfortunately, it only works for files, not for dirs, therefore
we're introducing a new file-specific rename function.

Differential Revision: D12940555

fbshipit-source-id: a6749a9b16a285788de0f5c06d51a15c919166ce
2018-11-07 10:37:23 -08:00
Mark Thomas
b7fe1b52f8 pushrebase: pluralize strings correctly
Summary: Pluralize strings using `mercurial.i18n._n`

Reviewed By: quark-zju

Differential Revision: D12944849

fbshipit-source-id: 536f2edf37fe5603cbf3c7737afb3445988b41f6
2018-11-07 04:32:46 -08:00
Mark Thomas
088e0a8ed6 pushrebase: only prevent phase updates if replacements received
Summary:
If the commits being pushrebased don't actually need to be rebased, pushrebase
will accept them like a normal push.  In this case we shouldn't prevent them
from be changed to public commits on the client.

Track this by detecting whether we receive a changegroup part from the server.
If we do, only the commits that are marked as replaced with obsmarkers (if
enabled) can be marked as public.

Reviewed By: quark-zju

Differential Revision: D12944851

fbshipit-source-id: 44f8fc17b36397d949cba5d3e787fad813bab4ea
2018-11-07 04:32:46 -08:00
Mark Thomas
9b4c89abe5 pushrebase: add test demonstrating pushrebase phase change failure
Summary:
When pushrebase is enabled, pushing a commit that doesn't result in any
rebasing action acts like a normal push (the commit is not modifed and a new
hash is not returned), however the phase update doesn't apply, so the commit
remains draft.

Reviewed By: quark-zju

Differential Revision: D12944850

fbshipit-source-id: 2145d9b7eebc27bfdff34544e73802c13f30dbd2
2018-11-07 04:32:46 -08:00
Jun Wu
f37a5d8df7 rust: upgrade rust to 1.30.0 and bump zstd-sys version
Summary:
The vendored crates were changed by D12811597. Bump `zstd-sys` in `Cargo.toml` to be compatible.
As we're here, also bump rust compiler to 1.30.0 so it's consistent with buck build.

Reviewed By: kulshrax

Differential Revision: D12952552

fbshipit-source-id: 6274bf829b98b16aeb6795209d12aba8b475b46d
2018-11-06 18:13:20 -08:00
Saurabh Singh
b496efcc9a test-hgsubversion-globalrevs: test revset interoperability
Summary:
D12888964 added the capability for `svnrev` revsets to be
interoperable with the `globalrev` revsets. This commit adds the tests for it.

Reviewed By: quark-zju

Differential Revision: D12888960

fbshipit-source-id: 07b12632d534a329c32179e978b058b1e427e688
2018-11-06 16:42:11 -08:00
Saurabh Singh
ff98fdcc08 test-hgsubversion-globalrevs: remove the capturing ui
Summary:
The capturing UI is not required as we can use the much cleaner
`ui.pushbuffer`/`ui.popbuffer` for the intended purpose.

Reviewed By: quark-zju

Differential Revision: D12906912

fbshipit-source-id: ae93e6417135ca23b28a11af63745464344fa3cf
2018-11-06 16:42:11 -08:00
Saurabh Singh
32b539a13a test-hgsubversion-globalrevs: add useful params to the assert log method
Summary:
This method always prints the graph for the commits in the repository.
This commit adds supports for specifying any revset as input for the log and
also, makes printing the graph optional.

Reviewed By: quark-zju

Differential Revision: D12888965

fbshipit-source-id: 794606fa17f9836fd73675d36d11220b11994f41
2018-11-06 16:42:11 -08:00
Saurabh Singh
e9ebb554f3 test-hgsubversion-globalrevs: include svnrev in tests instead of rev
Summary: The `svnrev` is more useful than the `rev` in this context.

Reviewed By: quark-zju

Differential Revision: D12888963

fbshipit-source-id: a902c57ecc3bc3eca9da77ab6e14ef58512d5ad8
2018-11-06 16:42:11 -08:00
Saurabh Singh
6f25c6e5c9 hgsubversion: support resolving revset string with prefix 'r' during tests
Summary:
This is required for testing `globalrevs` integration with
`hgsubversion`. In particular, we will test out whether we can resolve
`r<svnrev>/r<globalrev>` correctly later. Seems like this configuration should
be on during all the tests because it is the configuration we use in
production. Therefore, this commit in resolves revset string with prefix `r`
for all the `hgsubversion` tests.

Reviewed By: quark-zju

Differential Revision: D12888961

fbshipit-source-id: af9b2e1aea9771f42fe1fb2d3f9a759a926b1ce3
2018-11-06 16:42:11 -08:00
Saurabh Singh
51f556080f globalrevs: add support for interoperability with 'svnrev' revsets
Summary:
This commit adds support for the `globalrev` and `svnrev` based
revsets to be interoperable. In particular, we want the commands

```
   hg log -r "svnrev(<svnrev>/<globalrev>)"
   hg log -r "globalrev(<svnrev>/<globalrev>)"
   hg log -r "r<svnrev>/r<globalrev>"
   hg log -r "m<svnrev>/m<globalrev>"
```

to resolve to a commit with <svnrev> as the corresponding svn revision number
and <globalrev> as the corresponding strictly increasing global revision
number.

Reviewed By: quark-zju

Differential Revision: D12888964

fbshipit-source-id: 1c4e6e2cf3febb5a1d8a476554ad62cc630dc96e
2018-11-06 16:42:10 -08:00
Saurabh Singh
f9f787762f globalrevs: make the extension wrapping logic more clear
Summary:
After some cleanup and improvements by quark-zju, we only wrap the
`hgsql` extension for embedding `globalrev` in a commit. Therefore, lets remove
the unnecessary verbosity in the code and make it more clear.

Reviewed By: quark-zju

Differential Revision: D12888962

fbshipit-source-id: b1fcebd6ce6c9cdf1c5cb7bb8b3532695f20d32c
2018-11-06 16:42:10 -08:00
Saurabh Singh
0d204fba6f globalrevs: introduce configuration for specifying valid starting revision
Summary:
We need a configuration option for specifying the starting revision
beyond which we will consider the global revisions associated with the commit
valid for the following reasons:

 - It lets us have the flexibility to support `globalrevs` from a commit of our
   choice.
 - We need this configuration to decide when we should fallback to looking at
   the `svnrev` instead of the `globalrev`.

Reviewed By: quark-zju

Differential Revision: D12888966

fbshipit-source-id: 46d6314886ed5074edb537ba340d5606ec354619
2018-11-06 16:42:10 -08:00
Jeremy Fitzhardinge
911e07172e tp2/rust: update to rust-1.30.0
Summary:
rustc-1.30.0 tries to work out what the linker actually is from the name, and
gets confused because the script we pass it is actually gcc (or clang), but has
`ld` in the name. Update the command-line options to also pass
`-Zlinker-flavor=gcc` to override the linker flavor inference.

proc_macros are now stable. The `quote` crate has a dependency on the `proc_macro`
which is now a shared object as part of the rustc distribution, which means that things
using `quote` must have a runtime linkage with the rustc libraries. The Thrift `codegen`
binary is the main thing affected by this, and I've hacked around it by putting an
`LD_LIBRARY_PATH` in the Buck macros. Need to find a nicer fix though.

rustc 1.30 now implements `#[macro_export(local_inner_macros)]`, which has
strict semantics around namespaces and symbol hygiene, which doesn't work with
common/rust/sql's macros. Work around this for now by just exporting
everything.

Reviewed By: kulshrax

Differential Revision: D12811597

fbshipit-source-id: f18d12e6d99994876c29d3a6bd6ae43f1f37dd17
2018-11-06 16:16:09 -08:00
Jun Wu
a411ecb012 hgmain: remove default features
Summary:
The default feature requires additional environment setup. Since environment
setup cannot be avoided, let's rely on the "environment setup" logic to specify
"with_chg" feature correctly. So "cargo build" without specifying features can
work.

This might fix the Windows CI build.

Reviewed By: DurhamG

Differential Revision: D12948723

fbshipit-source-id: cf2609bccace69cd22a9e4ef4fd2c1fc1bf73338
2018-11-06 15:40:25 -08:00
Jun Wu
2c58a7b39f setup: fix libchg cflags
Summary: chg needs `_GNU_SOURCE` to build correctly.

Reviewed By: DurhamG

Differential Revision: D12947813

fbshipit-source-id: 26e3a7f506f959d016abba3e7a773d9f5940f19b
2018-11-06 14:36:47 -08:00
Durham Goode
718d19fce6 datapack: fix not including rename information in datapack blobs
Summary:
It turns out data packs contain the exact mercurial file blob,
including the rename metadata header. This is different from how loose files work, which
contain the non-headered text and instead store the rename in the history at the
end of the file.

Ideally we'd change datapacks to not store the metadata version of the file, but
unfortunately this is how it has always been, so instead we must change the
commit-straight-to-pack code to write the headered blob.

Differential Revision: D12936247

fbshipit-source-id: 3f909d2964d7f7200ac0e31e47bd195b0c9b03e5
2018-11-06 14:06:55 -08:00
Mark Thomas
529aa8872e absorb: use ngettext for message plurals
Summary: Pluralize messages using ngettext.

Reviewed By: quark-zju

Differential Revision: D12921683

fbshipit-source-id: a8dce90b3b9318597f888a8aca72351012de05ae
2018-11-06 03:19:01 -08:00
Mark Thomas
6f7fabcecf i18n: support ngettext for pluralized strings
Summary:
Support pluralized translation strings using ngettext.

This allows strings that are appropriately pluralized based on the count of the
item.  To use import `_n` from the `i18n` module and provide it with singular
and plural messages, along with the count of the item that should be pluralized:

```
from mercurial.i18n import _n

ui.write(_n("%d item processed", "%d items processed", count) % count)
```

When using `%`-based string formatting in Python, both variants of the format
string must have the same number of subsitutions: it's not possible to leave
out the `%d` in the singular case.

Reviewed By: quark-zju

Differential Revision: D12921684

fbshipit-source-id: 756d1350a827d0451a07279f6884ee57dba6ac9f
2018-11-06 03:19:01 -08:00
Mark Thomas
fcafaf9750 discovery: don't exclude extinct commits
Summary:
Discovery excludes extinct (obsoleted without any non-obsolete descendants)
commits from the candidates that can be exchanged.  This is unnecessary, and
the user may legitimately want to exchange an extinct commit.

Reviewed By: quark-zju

Differential Revision: D12924522

fbshipit-source-id: 1ea53f2c7bdfd7b4d97c6fbae43ebdcbaf322614
2018-11-06 03:14:58 -08:00
Kostia Balytskyi
9a14c01dfd hg.rust: add osx python installation path
Reviewed By: markbt

Differential Revision: D12922593

fbshipit-source-id: c74fc5b0227fb488b5e8d4690063220f9245e775
2018-11-05 11:54:44 -08:00
Kostia Balytskyi
475f7f8d90 hg.rust: add support for passing control to chg
Summary:
This is needed before we start moving builtins into `hg.rust`. The decision
to run or not run a builtin needs to be made before the decision to run or not
run a `chg`.

Reviewed By: quark-zju

Differential Revision: D10859033

fbshipit-source-id: 04018904684fc3c8ca2b927bfb828e40a8d09938
2018-11-05 10:08:29 -08:00
Kostia Balytskyi
c5aa7a01b3 chg: learn to build a static lib
Summary:
In order to be able to run `chg` from the main `hg.rust` binary, we decided
that we will turn it into a static lib. This diff teaches our current build
scripts to do this.

Reviewed By: quark-zju

Differential Revision: D10853906

fbshipit-source-id: 8e0f37aa7e52d4a0610f36d7903eb0a318c193ad
2018-11-05 10:08:29 -08:00
Xinyuan Wang
0c46230a94 lfs: log download size and time
Summary: Log the downloading time spend and the downloading size when hg is using lfs

Reviewed By: ikostia

Differential Revision: D12813953

fbshipit-source-id: adbcb8c508f5d3668b05d5c894cd7e32085a74f0
2018-11-05 10:01:00 -08:00
Aida Getoeva
dc09d0c75c move contentstore pending from localrepo to shallow
Summary: Not all of the repos are remotefilellog, so I moved some invocagions of the content store to shallowrepo and added requirements check where the transaction is processsed in localrepo

Reviewed By: quark-zju

Differential Revision: D12881916

fbshipit-source-id: 1119debd1e3d42cdf9513a6cae4bad4c000cc046
2018-11-05 07:53:24 -08:00
Mark Thomas
d15af3f239 cmdutil: remove amend message template
Summary:
Based on discussions about the best approach for solving the amend message
problem, back out the template previously added.  We will use a different
approach.

Reviewed By: mitrandir77, liubov-dmitrieva

Differential Revision: D12921753

fbshipit-source-id: ca760ffe14bfe473b7526a1b84a8cfc6b0257bf2
2018-11-05 06:28:03 -08:00
Mark Thomas
edd88465bd revsets: deprecate allpredecessors and allsuccessors
Summary:
The `predecessors` and `successors` cover all use cases now, so
`allpredecessors` and `allsuccessors` can be deprecated.

Also de-dup entries in the help text.  The addition of the old `precursors`
revset as an alias for `predecessors` makes `predecessors` appear write.

Reviewed By: phillco, mitrandir77

Differential Revision: D12884191

fbshipit-source-id: d87927f498df2296387b4542c4a9b704df334ce3
2018-11-05 02:30:57 -08:00
Jun Wu
f556edd8a4 fsmonitor: add migration to toggle tracking ignored files
Summary:
It turns out tracking ignored files does have an impact on status performance.
Filtering out the ignored directories is not that fast, and ignored files can
be scattered everywhere (like ".pyc", ".iml" files) that makes them harder to
be filtered out efficiently.

Add code paths to migrate between "ignored tracked" and "ignore untracked".
Store the metadata in treestate.

Reviewed By: phillco

Differential Revision: D12916021

fbshipit-source-id: e02d0c6f3b1a036f70703c11f35381c594e2f8e5
2018-11-03 11:12:56 -07:00
Jun Wu
9719d371db treestate: add a debug command to list treestate content
Summary: This is to replace `debugstate -v`. The latter does ont list untracked files.

Reviewed By: DurhamG

Differential Revision: D12906649

fbshipit-source-id: b84f41dfadff4932c0ddd48480a4aa03db88cab0
2018-11-03 11:12:56 -07:00
Jun Wu
3c85a515b1 match: fix visitdir fast path
Summary:
I was not aware that `**.c` is a valid glob pattern in hg when writing the
Python fast path.

`**` in glob patterns should disable fast paths because it can match paths with
`/` in them.

Reviewed By: DurhamG

Differential Revision: D12892725

fbshipit-source-id: b26a57dee57f074b3b8acb9dee95bc74103f4285
2018-11-01 17:07:27 -07:00
Adam Simpkins
640d8f6565 restore part of the mercurial.sparse module
Summary:
D12811551 removed the mercurial.sparse module.  However, actual removal of the
module needs to wait until the changes to the eden dirstate extension get
deployed.

This restores the module until all of the Eden changes have been deployed.
This module only contains a dummy `matcher()` function, which is the only part
of the module that Eden referenced.

This was causing exceptions for users with the a mercurial release from today,
but an Eden release from yesterday.  The exception would normally only occur
when using chg, since chg disables lazyimport.  Without chg, lazyimport would
allow the import to succeed even though the module does not exist.

Reviewed By: DurhamG

Differential Revision: D12877889

fbshipit-source-id: 2c6afd9bcb7031727b40fd32fbc1ba1356eb6e9b
2018-10-31 19:48:30 -07:00
Wez Furlong
caad413499 load blobs using hg's rust config and datapack code
Summary:
This diff implements getBlob on top of the mercurial rust
datapack code.  It adds a C++ binding on top of the rust code to
make it easier to use and hooks it up in the hg backing store.

Need to figure this out for our opensource and windows builds:

* Need to teach them how to build and link the rust code
* need to add a windows version of the methods that accept paths;
  this is just a matter of adding a WCHAR version of the functions.

Reviewed By: strager

Differential Revision: D10433450

fbshipit-source-id: 45ce34fb9c383ea6018a0ca858581e0fe11ef3b5
2018-10-31 17:58:17 -07:00
Phil Cohen
cbf94e4a87 hgsubversion: add SVN error code to "Outgoing changesets parent is not at subversion HEAD"
Summary: We'd like to identify which of the three underlying conditions cases this exception.

Reviewed By: quark-zju

Differential Revision: D12870572

fbshipit-source-id: 45724ad6bb3582c04a6ea3c0b7a748bf72219b93
2018-10-31 14:02:30 -07:00
Saurabh Singh
4a8d3f93e2 test-check-code: fix the test failure
Summary:
D12863838 broke the `test-check-code.t` by using `os.getcwd` instead
of `repo.getcwd`. This commit fixes the same.

Reviewed By: phillco

Differential Revision: D12870782

fbshipit-source-id: 5d9c0af5263fc38ca78526b84aa33a9dd8a6db3d
2018-10-31 13:04:02 -07:00
Saurabh Singh
a761dbd527 test-fb-hgext-tweakdefaults-grep: fix the test
Summary:
This test is broken after D12849852 because the grep outputs the files
in different order during multiple test runs. Let's fix it by sorting the
output from the command.

Reviewed By: phillco

Differential Revision: D12869810

fbshipit-source-id: 49073e83e926e94db5f0bd290d74845ebfde0bb6
2018-10-31 12:09:24 -07:00
Wez Furlong
6a1da8a4b7 hg: constrain biggrep to cwd or provided pattern dirs
Summary:
This helps to avoid over-fetching of results and addresses
some of the user feedback we've gotten.

This is an imperfect constraint because the mercurial matcher doesn't
appear to have a way to return an equivalent regex to us today.

Reviewed By: quark-zju

Differential Revision: D12863838

fbshipit-source-id: ef963455018f9902453e405a1a998d19f7bcde9d
2018-10-31 11:59:25 -07:00
Wez Furlong
e24e242728 hg: make hg portion of biggrep grep output have deterministic ordering
Summary: This is nicer for the user and makes the test not be flakey.

Reviewed By: quark-zju

Differential Revision: D12860852

fbshipit-source-id: 6ccb0ca679dc25a80730e83a26a39dd3becb5c8f
2018-10-31 11:59:25 -07:00
Mateusz Kwapich
c697c8b81a commands: avoid implicit bool cast in "update" parameter validation
Summary: This fixes the "hg prev" targetting the first commit in the repo. The problem was the rev `0` which casted to false in all the checks.

Reviewed By: phillco

Differential Revision: D12840237

fbshipit-source-id: 594a2725fa125ee713f347379c875ec54b80a53d
2018-10-31 10:27:53 -07:00
Mateusz Kwapich
292728707f tests: set disallowemptyupdate in "hg prev" test
Summary:
This brings the config closer to what we use and uncovers some problems with
disallowemptyupdate itself.

Reviewed By: phillco

Differential Revision: D12840239

fbshipit-source-id: 77740b79114c7d901b0181e0e425aea4e9c7c570
2018-10-31 10:27:53 -07:00
Jun Wu
72e559cb76 dirstate: restore "sparsematchfn" argument
Summary:
Before D10316761, we cannot upgrade both Eden and hg atomically. Therefore
restore the API change so newer hg works with older eden, and newer eden works
with older hg.

Reviewed By: wez

Differential Revision: D12855935

fbshipit-source-id: 448a67ee748e39d33a64f62c702e0c45aea2ecae
2018-10-31 02:50:28 -07:00
Jun Wu
5f29ac4c8e hgsql: set client-side timeout
Summary:
Previously there are only server-side timeouts. When the server goes wrong, the
client can hang forever. This diff sets the client-side timeout at the Python
socket object.

Reviewed By: phillco

Differential Revision: D12854064

fbshipit-source-id: 71307b305f8e8e936d7d395c76b5e8ef92c6a089
2018-10-30 19:28:50 -07:00
Jun Wu
78584bd37d sparse: drop mercurial.sparse
Summary: We're using hgext.sparse.

Reviewed By: phillco

Differential Revision: D12811551

fbshipit-source-id: 780ec51350a62f4cfd3a31a0d4a1c61f6f72e38a
2018-10-30 19:22:43 -07:00
Wez Furlong
67f16a7484 hg: fixup biggrep implementation
Summary:
a couple of problems:

* The recent move from tweakdefaults also broke `bin` symbol, rendering
  this feature completely broken for non svn backed repos
* The `bgr` tool knows about fewer corpuses than we do, so go directly
  to the underlying C++ client binary
* Add configuration options for that binary

Reviewed By: phillco, farnz

Differential Revision: D12849852

fbshipit-source-id: 154d4822d097602505349d3f67b45f19c17a7bf8
2018-10-30 19:13:56 -07:00
Jun Wu
467daedf2e osutil: get argv[0] on Linux more reliably
Summary:
`environ` might be changed by `setenv` and would be wrong to locate `argv[0]`.
Linux >= 3.5 provides the `argv[0]` pointer in `/proc/self/stat`. Let's use
that instead.

Reviewed By: ikostia

Differential Revision: D12834877

fbshipit-source-id: d76804e8f4113cdf3adb0cceed817f7e93d1b6de
2018-10-30 14:11:16 -07:00
Aida Getoeva
8940a7c464 uncommit: move to core
Summary: Moving extension `uncommit` to the core.

Reviewed By: quark-zju

Differential Revision: D10447651

fbshipit-source-id: 2ccf7db858b78e0811ffef742c82237259492719
2018-10-30 08:00:05 -07:00
Aida Getoeva
c6fc789a82 uncommit: remove unused function
Summary: This function is duplicated to `hgext/amend/unamend.py` and is used there but not in the uncommit

Reviewed By: quark-zju

Differential Revision: D10447652

fbshipit-source-id: e6d001ae5f652214c3b1bf3b9f343e7e64874721
2018-10-30 08:00:05 -07:00
Mark Thomas
92674884fd progress: clear progress bar when locking to suspend
Summary:
The recent changes to the progress engine to work around locking bugs removed
the `clear` step of `progress.suspend`.  This leads to garbled output when
a progress bar is ongoing.  Restore it by adding a new lock method to the
engine.

Also add a `--with-output` option to `hg debugprogress` to test this.

Reviewed By: mitrandir77

Differential Revision: D12838415

fbshipit-source-id: 83ed516b528d0b0bbe37945141d50b50da00ac8e
2018-10-30 07:41:05 -07:00
Mark Thomas
2deae85b42 encoding: use Cow for returned types that may be references
Summary:
I broke the Windows build because the return type of `path_to_local_bytes` is
different on Windows and Unix, and so must be dealt with differently.  They are
different because on Windows we often need to make a copy, whereas on Unix we
can just use references to the byte data.  Cows to the rescue: unify them
behind a Cow type.

While we're here, tidy up and unify the docs.

Reviewed By: quark-zju, ikostia

Differential Revision: D12833091

fbshipit-source-id: e02e308e6f81dd3d8ddf33e76c3073f51d3eccc1
2018-10-30 04:07:02 -07:00