Commit Graph

43075 Commits

Author SHA1 Message Date
Mark Thomas
d28e778f85 fixcorrupt: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329520

fbshipit-source-id: fccd015d96ef608eb2cae534b6f991bd96bf83b2
2018-04-13 21:51:33 -07:00
Mark Thomas
77d4bc2b83 fbsparse: use new-style progress bars
Reviewed By: mjpieters

Differential Revision: D7329504

fbshipit-source-id: 8037f704f88ea8b7d02ef323932143298fef5c66
2018-04-13 21:51:33 -07:00
Mark Thomas
52d272277f fastannotate: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329490

fbshipit-source-id: 3c8bf8b0590b1d3e5bf567849de4b7c88ea8b894
2018-04-13 21:51:33 -07:00
Mark Thomas
eb318ffa63 convert: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329501

fbshipit-source-id: 5312f905b513200904c79acbdb1c7b17968a8aba
2018-04-13 21:51:33 -07:00
Mark Thomas
af359e3856 churn: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329481

fbshipit-source-id: 4bf764216e23c1e38efe19340eabd7a29f960e64
2018-04-13 21:51:33 -07:00
Mark Thomas
1575ac85e1 httpconnection: remove old-style progress bar
Summary:
httpconnection uses old-style progress bars in a way that isn't easy to
replicate using new-style progress bars.  Remove it for now, it can be added
back in later in the right place.

Reviewed By: quark-zju

Differential Revision: D7329486

fbshipit-source-id: 814c55d7a5bb5c97fc6b3967510ed656110038c8
2018-04-13 21:51:33 -07:00
Mark Thomas
fb4c6e652c verify: use new-style progress bars
Reviewed By: mjpieters

Differential Revision: D7329516

fbshipit-source-id: 4e18bd639f292c3dcb8b6c33f1322b85ed40c043
2018-04-13 21:51:33 -07:00
Mark Thomas
9d89d36068 verify: refactor _verifymanifests
Summary:
The recursive function _verifymanifests behaves differently for the root and
non-root manifests in treemanifest.  Split out the behaviour into separate
functions in preparation for reworking the progress bar to the new style.

Reviewed By: quark-zju

Differential Revision: D7329518

fbshipit-source-id: 4f499354060d7397a6a9781d15df26a0343c8fca
2018-04-13 21:51:33 -07:00
Mark Thomas
d5f068eebb upgrade: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329517

fbshipit-source-id: 66dc4a84c12967382e2e244fcff10fbdd8068777
2018-04-13 21:51:32 -07:00
Mark Thomas
9fe044b560 treediscovery: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329493

fbshipit-source-id: f7a4d9d38e6ac53e9d12fee1ad8300a3c7654d2c
2018-04-13 21:51:32 -07:00
Mark Thomas
e0ebeb5325 subrepo: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329515

fbshipit-source-id: d35a7e4a6ad9a78da9b74863b83811dd4e9f2e9e
2018-04-13 21:51:32 -07:00
Mark Thomas
7df8b26ee9 streamclone: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329478

fbshipit-source-id: 34ef05de908afd87a23cbaeb657e66a39af46b8b
2018-04-13 21:51:32 -07:00
Mark Thomas
a285514e0b similar: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329510

fbshipit-source-id: 296e2cbb5381088253eb138600b45a72bbcb3d84
2018-04-13 21:51:32 -07:00
Mark Thomas
6f72915069 setdiscovery: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329480

fbshipit-source-id: da4825435b32887daec71e30bc23aa3dc7c9696d
2018-04-13 21:51:32 -07:00
Mark Thomas
30460a0584 repair: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329514

fbshipit-source-id: d0a0792e1954a9cb895dccbb087f9cd921de3391
2018-04-13 21:51:32 -07:00
Mark Thomas
36531369fc merge: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329511

fbshipit-source-id: 73afeb70cf3cce35a290588bd1d8f57d09baf3f8
2018-04-13 21:51:32 -07:00
Mark Thomas
2640f4cf42 debugcommands: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329487

fbshipit-source-id: 74b4fabd62242556b04d29c3e8be40eeae444cc7
2018-04-13 21:51:32 -07:00
Mark Thomas
c13d19c577 cmdutil: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329499

fbshipit-source-id: 429fd5a7c1cbbfe4734f940b74a3333cb57af455
2018-04-13 21:51:32 -07:00
Mark Thomas
b475295681 changegroup: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329508

fbshipit-source-id: b887265f9ceb051d14706bfee8708bbd4c74557d
2018-04-13 21:51:32 -07:00
Mark Thomas
ded1a17e97 archiving: use new-style progress bars
Reviewed By: ryanmce

Differential Revision: D7329713

fbshipit-source-id: 49e6c17f7e54f6a728fc48cd6569ec1a7768cebe
2018-04-13 21:51:32 -07:00
Mark Thomas
f1508781f5 hg: use new-style progress bars for copystore
Summary:
Update hg.copystore and util.copyfiles to use the new-style progress bar
context manager.

Reviewed By: ryanmce

Differential Revision: D7329482

fbshipit-source-id: 4ac1def57e0ae4e7819c7c0c4d6f1715b8cbb625
2018-04-13 21:51:31 -07:00
Mark Thomas
f1ff6d7c4c progress: only update if value changes
Summary:
New-style progress bars should only update if there has been any progress since
the last refresh.  Otherwise, stalls in progress cause weird behaviour for time
estimates.

Reviewed By: DurhamG, quark-zju

Differential Revision: D7329494

fbshipit-source-id: 43b9fdd5573b34174673db838e53a0d54504eefd
2018-04-13 21:51:31 -07:00
Mark Thomas
092c5a7896 progress: add debugbar implementation
Summary:
`progress.debugbar` is an implementation of the `progress.bar` context that
behaves like the old progress bar implementation when used in tests.

Reviewed By: DurhamG

Differential Revision: D7329500

fbshipit-source-id: 28c96c1ddf096efbec6994cf5b4dea04f88d55d3
2018-04-13 21:51:31 -07:00
Durham Goode
4ac2448524 hg: handle case when manifest revlog is missing a node
Summary:
Previously, when looking for a treemanifest we'd inspect the flat
manifest revlog to get a hint for which nearby manifests might exist. This
assumed the data was in the flat manifest though, and if it wasn't it threw an
exception which caused us to not look at the server for the tree.

This commit fixes the case where the flat manifest doesn't have the commit, so
it can still look at the server.

Reviewed By: quark-zju

Differential Revision: D7343608

fbshipit-source-id: 57d5da9a8b8d71e33df9a8a0647b7bfe8815e37b
2018-04-13 21:51:31 -07:00
Kostia Balytskyi
34270dbbe0 hg: utilize the data_files property of py2exe packager
Summary:
This fixes `hg serve` [1] by adding templates to the distribution and also puts copying of `CONTRIBUTING` and `CONTRIBUTORS` in the right place.

[1] https://fburl.com/w1oerx2f

Reviewed By: ryanmce

Differential Revision: D7341585

fbshipit-source-id: e6b022309f10ef0dc958e06bc7955c626cc6cee7
2018-04-13 21:51:31 -07:00
Jun Wu
e83f8cfa4d rust: add more dependencies
Summary: Add crates that are used in the upcoming matcher implementation.

Differential Revision: D7319606

fbshipit-source-id: c269aa9afac635838940239f3e5ab173c38b2429
2018-04-13 21:51:31 -07:00
Jun Wu
66a8415930 pushrebase: add a test about hash preservation behavior
Summary:
Tests pushrebase can preserve commit hash if rewritedates is set to False.
This is the desired property mentioned in T26625986.

Reviewed By: DurhamG

Differential Revision: D7280498

fbshipit-source-id: e8943ddfec55a524c5cfd1dc9de765eace1e5296
2018-04-13 21:51:31 -07:00
Martijn Pieters
36a3e5b595 sparse: use -l as the short option for --list-profiles
Summary: There's a precedent for `-l` for listing: `hg shelve -l`, `hg undo -l`, `hg resolve -l`.

Reviewed By: ryanmce

Differential Revision: D7337527

fbshipit-source-id: 3d9c340590e9756e39cad3bfdd0b017f45fd3a6e
2018-04-13 21:51:31 -07:00
Durham Goode
25ab786e07 hg: allow backfilling trees for a nullid manifest
Summary:
We have some repo's whose first commit didn't not add any files, which
means they have nullid as their manifest pointer which breaks backfilltrees.
This patch fixes that.

Reviewed By: singhsrb

Differential Revision: D7340678

fbshipit-source-id: 85b048b81c1861fd48d5cc082d414271aee7283b
2018-04-13 21:51:31 -07:00
Martijn Pieters
efd45069e3 sparse: use relglob to exclude readme files
Summary: Although the old glob *should* work, in practice the treemanifest matcher seems to have issues with glob:**/ paths, where relglob: works.

Reviewed By: ryanmce

Differential Revision: D7287992

fbshipit-source-id: d3802e730d937eeca7059dac691d8dac5a5de262
2018-04-13 21:51:31 -07:00
Durham Goode
df8173b17b hg: add --configfile global option
Summary:
This adds the ability to specify a config file to be used during the
command. This is useful during clones for letting the clone command use the
given repositories system specified repo-specific hgrc file.

Reviewed By: quark-zju

Differential Revision: D7311576

fbshipit-source-id: a97d8ebada2e0bea27c75a7650df8ede00dc10c6
2018-04-13 21:51:31 -07:00
Jun Wu
5ce4e0f541 patch: disable worddiff if HGPLAIN is set or color is disabled
Summary:
worddiff needs extra computation and does not have effect if color is
disabled. It should also be disabled with HGPLAIN=1.

Reviewed By: ryanmce

Differential Revision: D7315276

fbshipit-source-id: b59255bc708713186bd4ddafdc469763e1a66ea6
2018-04-13 21:51:31 -07:00
Jun Wu
97411a0738 patch: rewrite the worddiff algorithm
Summary:
There were recent complains about both quality [1] [2] and performance [3]
of the current word diff algorithm.

The current algorithm is actually bad in various ways:

  - Lines could be matched across hunks, which is confusing (report [1]).
  - For short lines, they can fail "similarity" check, which means they
    won't be highlighted when they are expected to be (report [2]).
  - Various performance issues:
    - Using difflib implemented by pure Python, which is both slow and
      suboptimal comparing with xdiff.
    - Searching for matched lines across hunks could be O(N^2) if there are
      no match found.

Thinking it in a "highlight" way is actually tricky, consider the following
change:

```
  # before
  foo = 10

  # after
  if True:
      foo = 21 + 3
```

It's obvious that "10" and "21 + 3" need highlighting because they are
different.  But what about "if True:"? In theory it's also "different" and
need highlighting. How about purely inserted or deleted hunks then?
Highlighting all of them would be too noisy.

This diff rewrites the word diff algorithm. It differs in multiple ways:

  1. Get rid of "matching lines by similarity" step.
  2. Only diff words within a same hunk.
  3. Dim unchanged words. Instead of highlighting changed words.
  4. Treat pure insertion or deletion hunks differently - do not dim or
     highlight words in them.
  5. Use xdiff instead.
  6. Use a better regexp to split words. This reduces the number of tokens sent
     to the diff algorithm.

1, 2, 5, 6 help performance. 1, 2, 3, 4 make the result more predictable and
trustworthy. 3 avoids the nasty question about what to highlight. 3 and 4 makes
it more flexible for people to tweak colors. 6 makes the result better since it
merges multiple space tokens into one so xdiff will less likely miss important
matches (than meaningless matches like spaces).

"bold" and "underline" were removed so the changed words will have regular
red/green colors. The output won't be too "noisy" even in cases where code are
changed in a way that inline word matching is meaningless. For people who want
more contrast, they can set:

  [color]
  diff.inserted.changed = green bold
  diff.deleted.changed = red bold

Practically, when diffing D7319718, the old code spends 4 seconds on finding
matched lines preparing for worddiff:

```
           | diffordiffstat                     cmdutil.py:1522
            \ difflabel (17467 times)           patch.py:2471
             ....
> 3927        \ _findmatches (22 times)         patch.py:2537
   348          \ __init__ (8158 times)         difflib.py:154
   340           | set_seqs (8158 times)        difflib.py:223
   328           | set_seq2 (8158 times)        difflib.py:261
   322           | __chain_b (8158 times)       difflib.py:306
  1818          \ ratio (8158 times)            difflib.py:636
  1777           | get_matching_blocks (8158 times) difflib.py:460
  1605            \ find_longest_match (51966 times) difflib.py:350
    38             | __new__ (51966 times)      <string>:8
    29            \ _make (36035 times)         <string>:12
   143      \ write (17466 times)               ui.py:883
```

The new code takes 0.14 seconds:

```
             | diffordiffstat                   cmdutil.py:1522
              \ difflabel (23401 times)         patch.py:2562
               ....
>  140          \ consumehunkbuffer (23346 times) patch.py:2585
   130           | diffsinglehunkinline (23240 times) patch.py:2496
   215        \ write (23400 times)             ui.py:883
   118    \ flush                               cmdutil.py:1606
   118     | write                              ui.py:883

```

[1]: https://fburl.com/lkb9rc9m
[2]: https://fburl.com/0r9bqf0e
[3]: https://fburl.com/pxqznw31

Reviewed By: ryanmce

Differential Revision: D7314726

fbshipit-source-id: becd979cb9ac3fd3f4adae11cb10804d535f58df
2018-04-13 21:51:30 -07:00
Jun Wu
582d06422e patch: buffer lines for a same hunk
Summary:
Instead of yielding tokens directly, buffer them if they belong to a same
hunk. This makes it easier for the upcoming new worddiff algorithm to only
focus on the diff hunk, instead of having to worry about other contents.

This breaks how the existing experimental worddiff algorithm works, so the
algorithm was removed, and related tests are disabled for now.

Reviewed By: ryanmce

Differential Revision: D7314725

fbshipit-source-id: 344e502cd185b2412fbd2ee299131bbb4560ac17
2018-04-13 21:51:30 -07:00
Jun Wu
44fe605864 patch: move yielding "\n" to the end of loop
Summary:
The original logic makes it harder to reason about - it yields the "\n"
character belonging to the last line in the next loop iteration.

The new code is in theory a little bit slower. But is more readable. It
makes the following changes easier to read.

Reviewed By: ryanmce

Differential Revision: D7314727

fbshipit-source-id: cb792577adc8f7629bc2e0fe8f0688e705bf4b30
2018-04-13 21:51:30 -07:00
Durham Goode
b964f5d745 hg: always send all trees to the main server
Summary:
A prior diff optimized push/pull to not send public trees between
peers, since those trees can be downloaded from the main server. Let's be
careful when sending data to the main server and always send everything.

In the future we should add validation on the server that the received data is
complete, but Mercurial doesn't currently do that today.

Differential Revision: D7296253

fbshipit-source-id: 49513685d19991a70d66da1d734ddae23491ed0c
2018-04-13 21:51:30 -07:00
Durham Goode
58c32fe0c3 hg: pass the bundle2 caps down to the changegroup packer
Summary:
Previously, during a push the changegroup packer had no information about the
destination server, aside from what changegroup version it supported. In a
future diff we'll want to package certain files and trees based on if the server
is a main server or not, so let's pass thread the bundle2caps down to the
changegroup packer.

The changegroup already had the old style bundlecaps on it, but those
capabilities don't actually exist on the client side during a push, so let's
just use the bundle2 ones, which are more modern anyway.

Differential Revision: D7297899

fbshipit-source-id: 74ab529baccbdc999267555779a10c0d27f8bd47
2018-04-13 21:51:30 -07:00
Durham Goode
d7d4e3f019 hg: enable pushing treeonly commits without pushrebase
Summary:
This allows pushing a treeonly pack to a server without using
pushrebase.

Differential Revision: D7295686

fbshipit-source-id: b0bfe4fbb04bc765e57f1db82909fa1ae7b3063b
2018-04-13 21:51:30 -07:00
Phil Cohen
67a6bf19bd add repack --looseonly
Summary:
It can sometimes be nice to be able to just repack loose data and avoid existing packs.

This came up during building the megarepo, which creates many loose files, but including the packs added too much repack time.

Differential Revision: D7209296

fbshipit-source-id: 10afed40e409733e0ee004f025013cf86f3f7bf6
2018-04-13 21:51:30 -07:00
Ryan McElroy
b2007943be templater: provide hint for templates with parse errors
Summary: Help people debug issues by providing useful hints when templates fail to parse.

Differential Revision: D7148780

fbshipit-source-id: bd2b0f2bdeb0c970732fcaf53854d4a003b08571
2018-04-13 21:51:30 -07:00
Ryan McElroy
2e2949fcbf revsetlang: add a hint for more useful parse errors
Summary:
This logic is largely based on the similar logic added to template error
messages in D2608 and D2609, but with a few tweaks based on how revsets
actually work.

Differential Revision: D7148779

fbshipit-source-id: fb435788711a2c4ef881dfaeac5176fc1972c07a
2018-04-13 21:51:30 -07:00
Phil Cohen
0a91c90b9c fsmonitor: don't invoke watchman on in-memory updates
Summary: Previously, this function assumed all calls to `merge.update` affected the working copy. That's no longer true with in-memory merge, so let's adapt it accordingly.

Reviewed By: DurhamG, singhsrb

Differential Revision: D7297552

fbshipit-source-id: d2eb299b6b6e8cf4a3ed3357ae51cbd13c144534
2018-04-13 21:51:30 -07:00
Durham Goode
50392ae4cf hg: fix linknodes in new trees
Summary:
Previously we were just putting nullid as the linknode in client side
trees, because when the trees were added the changelog hadn't been written yet,
so we didn't know the linknode. This diff updates manifestlog.add to pass
linkrevs to mutablehistorypack, which get resolved at serialization time into
the appropriate linknode.

Reviewed By: ryanmce

Differential Revision: D7280104

fbshipit-source-id: bbc8a7bfad31da296a1b65973875ba2e1e1f7a95
2018-04-13 21:51:30 -07:00
Durham Goode
0a624e63f7 hg: specify kwargs name for linkrev
Summary:
The linkrev parameter is a named parameter, so let's use it's name
instead of relying on the order. This is just a cleanliness diff.

Reviewed By: ryanmce

Differential Revision: D7280108

fbshipit-source-id: 88a02d0b5ccb1f586fdc01fb3cb2cd44a70e82e9
2018-04-13 21:51:29 -07:00
Durham Goode
668b782de4 hg: support linkrevs in mutablehistorypack
Summary:
Previously we were just putting nullid as the linknode in client side
trees, because when the trees were added the changelog hadn't been written yet,
so we didn't know the linknode. This diff updates mutablehistorypack to allow
resolving the linknodes at serialization time instead of add time. This will be
used in a future diff to fix storing linknodes in trees.

Reviewed By: ryanmce

Differential Revision: D7280105

fbshipit-source-id: 70063e627d0fd7baeb017bac5ac55957a100d06c
2018-04-13 21:51:29 -07:00
Durham Goode
e2ab772767 hg: use the correct linknode in converttotrees
Summary:
Previously converttotrees relied on being passed a linkrev to pass to
manifestlog.add(). If a linkrev wasn't provided though, it would pass None and
no linknode was stored. If a linknode is available, let's prefer that, and only
use the linkrev when we have to.

Reviewed By: ryanmce

Differential Revision: D7280109

fbshipit-source-id: d17015789a213fab6ff57563216e6943d2525fee
2018-04-13 21:51:29 -07:00
Durham Goode
976ae65ec7 hg: add linknode to manifestlog.add apis
Summary:
Previously we were just putting nullid as the linknode in client side
trees, because when the trees were added the changelog hadn't been written yet,
so we didn't know the linknode. As part of fixing this, let's add linknode to
the manifestlog.add api. A future diff will fill this in with the right value.

Reviewed By: ryanmce

Differential Revision: D7280103

fbshipit-source-id: dad3d2456e0cbde39392bf77af53ceeaadb49913
2018-04-13 21:51:29 -07:00
Durham Goode
ae52f1bd3c hg: don't send tree packs as part of pushrebase pushes
Summary:
Previously pushrebase pushes would send a tree pack part as well as a
rebase pack part. The tree pack part was ignored. Let's make receiving tree pack
parts on the server an error, and instead make the client not send them if it's
doing a pushrebase push.

A future diff will come back and add support for non-pushrebase push of tree
packs. This diff just makes use sure that the new logic won't run during
pushrebase.

Reviewed By: ryanmce

Differential Revision: D7267802

fbshipit-source-id: cabff989c178afb3706b77a03a299bcf3195f289
2018-04-13 21:51:29 -07:00
Durham Goode
161a6ddc0d hg: make infinitepush rebundling use the right bundlecaps
Summary:
infinitepush rebundling wasn't passing the appropriate bundlecaps. This
caused treeonly repositories to receive flat manifests from infinitepush
bundles. This allowed treeonly clients to receive the data and convert it to
trees, but really we should just convert the data to trees on the server before
we send and not rely on the client to be able to accept flat manifests.

Now that we no longer send flat manifests, we rely on the recently added
conversion logic to turn flat manifests into trees when necessary.

This will be required for turning the server into a treeonly client anyway.

Differential Revision: D7256556

fbshipit-source-id: bbaf9d4570eebd9f200004e34044b5b1a8c53e2e
2018-04-13 21:51:29 -07:00
Durham Goode
0803faf09d hg: make infinitepush convert flat manifests to trees during rebundling
Summary:
Currently infinitepush relies on the ability to send flat manifests to
tree clients and the clients doing the conversion. This relies on a hack where
we don't pass the bundlecaps to the infinitepush changegroup creator, so it
doesn't realize it's talking to a treeonly client and therefore sends flat
manifests to a treeonly client. This is hacky. To fix this, let's start by
making it possible for the server to generate trees on demand from the flat
manifests. This will also be useful later when the server is treeonly, so it can
ondemand generate old flat bundles into a treeonly one.

A later diff will then pass the appropriate bundlecaps to the rebundle
changegroup function.

Reviewed By: ryanmce

Differential Revision: D7256554

fbshipit-source-id: 40d5d9537a5e11b3d186c8ec9a2579261f1b772e
2018-04-13 21:51:29 -07:00