Commit Graph

43042 Commits

Author SHA1 Message Date
Mark Thomas
0d739795cc progress: add fancyrenderer for colorful progress bars
Reviewed By: quark-zju

Differential Revision: D7329656

fbshipit-source-id: b6592319177387d615547ff27f8f38efe85838ba
2018-04-13 21:51:34 -07:00
Mark Thomas
8d01284b55 progress: re-implement progress bar engine
Reviewed By: quark-zju

Differential Revision: D7329657

fbshipit-source-id: 4ba5152269ea8a598f13f0ae1e9e792c3b9542bb
2018-04-13 21:51:34 -07:00
Mark Thomas
aa338235f8 util: add util.ring, a ringbuffer of fixed length
Reviewed By: quark-zju

Differential Revision: D7329654

fbshipit-source-id: fa918ba5e77dc444705737be7e34bbb3c70f91ef
2018-04-13 21:51:34 -07:00
Mark Thomas
e09288137b ui: deprecate ui.progress
Summary:
Remove ui.progress as a method of updating progress.  All progress bars now go
through new-style progress bars.

This also splits out the rendering of progress bars from the reporting of
progress.  All tests are updated to use new-style debug progress bars, which
simply report the position of the progress bar.  Rendering of progress bars
will be tested separately once the progress bar engine has been rewritten.

Reviewed By: quark-zju

Differential Revision: D7329488

fbshipit-source-id: 14f8ab67365ddd98b74986aa25d9abc7a0546144
2018-04-13 21:51:34 -07:00
Mark Thomas
d67787ff6a upgradegeneraldelta: use new-style progress bars
Reviewed By: mjpieters

Differential Revision: D7329492

fbshipit-source-id: 49cac8963e36702569fdfa32856fca59452629b0
2018-04-13 21:51:34 -07:00
Mark Thomas
896813a257 treemanifest: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329497

fbshipit-source-id: aa19b579e6b57dd08271abf94f370e5491515d96
2018-04-13 21:51:34 -07:00
Mark Thomas
e59d61a2f5 remotefilelog: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329507

fbshipit-source-id: 9648bb7ec34a682238fc9ede96e8cdf63a45bdf9
2018-04-13 21:51:34 -07:00
Mark Thomas
79e7eb9a8e relink: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329513

fbshipit-source-id: a801e9c13f6c4912bffa9c08994e899761c1fc08
2018-04-13 21:51:34 -07:00
Mark Thomas
1ee8d6bace rebase: use new-style progress bars
Reviewed By: mjpieters

Differential Revision: D7329479

fbshipit-source-id: 75b53d9ca34b3670c60a79138a388f096a4a7275
2018-04-13 21:51:34 -07:00
Mark Thomas
2f6ee7d5e2 patchbomb: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329489

fbshipit-source-id: 3ac24272c286d47a61ed131ba217a2a9d07d9839
2018-04-13 21:51:34 -07:00
Mark Thomas
ced425bc04 p4fastimport: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329509

fbshipit-source-id: 5006ab9555d37102e430a6c6d9994d869ec512dc
2018-04-13 21:51:34 -07:00
Mark Thomas
4d96e98cae linkrevcache: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329505

fbshipit-source-id: 674729586260d218c3d070d0d36a8e57def817a7
2018-04-13 21:51:34 -07:00
Mark Thomas
b91b10e988 lfs: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329485

fbshipit-source-id: 4d6763ca6eed94a72ba59b1f8c8e4a506d8b5929
2018-04-13 21:51:33 -07:00
Mark Thomas
b1d366cb34 histedit: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329484

fbshipit-source-id: 038b8405a76aba4b4bc540c752beda6f1cfd4a4c
2018-04-13 21:51:33 -07:00
Mark Thomas
50792d83d8 hgsubversion: use new-style progress bars
Reviewed By: mjpieters

Differential Revision: D7329498

fbshipit-source-id: 138dcd425ceb6e8e35c134555bfb07c1680e5674
2018-04-13 21:51:33 -07:00
Mark Thomas
b46a47be82 hgsql: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329506

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

Differential Revision: D7329502

fbshipit-source-id: e12c77f511034ecedd521709523c3674c133d181
2018-04-13 21:51:33 -07:00
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