Commit Graph

43114 Commits

Author SHA1 Message Date
Jun Wu
5ea461493e build: build Rust matcher
Summary: Build the new Rust matcher with both buck and setup.py

Reviewed By: markbt

Differential Revision: D7319607

fbshipit-source-id: c5944a28602495a9127acb20b59eb95632a9a1f5
2018-04-13 21:51:40 -07:00
Jun Wu
2136058b36 matcher: expose Rust matcher's features to Python
Summary:
It only contains a `gitignorematcher` which exposes `GitignoreMatcher`
features to Python.

Reviewed By: markbt

Differential Revision: D7319605

fbshipit-source-id: 846964a551813f9b0933bc30f4a0ba3f85362944
2018-04-13 21:51:40 -07:00
Jun Wu
283b8d130d pathmatcher: initial Rust matcher that handles gitignore lazily
Summary:
The "pathmatcher" crate is intended to eventually cover more "matcher"
abilities so all Python "matcher" related logic can be handled by Rust.
For now, it only contains a gitignore matcher.

The gitignore matcher is designed to work in a repo (no need to create
multiple gitignore matchers for a repo from a higher layer), and be lazy
i.e. be tree-aware, and do not parse ".gitignore" unless necessary.

Worth mentioning that the gitignore logic provided by the "ignore" crate
seems decent in time complexity - it uses regular expression, which uses state
machines to achieve "testing against multiple patterns at once", instead of
testing patterns one-by-one like what git currently does.

Note: The "ignore" crate provides a nice "Walker" interface but that does
not fit very well with the required laziness here. So the walker interface
is not used.

Reviewed By: markbt

Differential Revision: D7319609

fbshipit-source-id: ebd131adf45a38f83acdf653f5e49d0624012152
2018-04-13 21:51:40 -07:00
Jun Wu
901e92e858 colors: improve compatibility
Summary:
- Support 8 color mode, since some terminals (emacs) do not support 16
  colors (i.e. "bright*" colors have no effects).
- Detect emacs and use 8 color mode automatically.
- Read terminfo colors. Respect it if it says the terminal supports more
  colors. Suggested by wez.
- Read HGCOLORS. Respect it unconditionally. Change run-tests.py to set it.
- Change diff related colors to also fallback to 8 colors since "bright"
  colors are not guaranteed available.

Differential Revision: D7432965

fbshipit-source-id: da75829f856b4de737b946af72d24ff5351026cb
2018-04-13 21:51:40 -07:00
Mark Thomas
2fed5ca134 smartlog: add smart date display to smartlog
Summary:
Adds two new template functions:

* `simpledate` formats recent dates in a human-friendly way, for example `Today
  at 12:00`, `Wednesday at 07:30`, or `Jan 05 at 23:45`.  The timezone used
  can be overridden.

* `smartdate` shows different results depending on whether a date is recent
  or not, where "recent" is defined by a threshold parameter.

Reviewed By: quark-zju

Differential Revision: D7123734

fbshipit-source-id: 7b68207e4debc85c0bfa72bba9b375a4aa11d7c6
2018-04-13 21:51:40 -07:00
Jun Wu
a87fea077c indexedlog: prefix in-memory entries with Mem
Summary: This makes it clear the code has different code paths for on-disk entries.

Reviewed By: DurhamG

Differential Revision: D7422836

fbshipit-source-id: 018fa0e2c20682d4e1beba99f3307550e1f40388
2018-04-13 21:51:40 -07:00
Jun Wu
3332522d43 indexedlog: add some benchmarks
Summary:
Add benchmarks inserting / looking up 20K entries.

Benchmark results on my laptop are:

  index insertion         time:   [6.5339 ms 6.8174 ms 7.1805 ms]
  index flush             time:   [15.651 ms 16.103 ms 16.537 ms]
  index lookup (memory)   time:   [3.6995 ms 4.0252 ms 4.3046 ms]
  index lookup (disk)     time:   [1.9986 ms 2.1224 ms 2.2464 ms]
  index clone (memory)    time:   [2.5943 ms 2.6866 ms 2.7749 ms]
  index clone (disk)      time:   [5.2302 us 5.5477 us 5.9518 us]

Comparing with highly optimized radixbuf:

  index insertion         time:   [991.89 us 1.1708 ms 1.3844 ms]
  index lookup            time:   [863.83 us 945.69 us 1.0304 ms]

Insertion takes 6x time. Lookup from memory takes 1.4x time, from disk takes
2.2x time. Flushing is the slowest - it needs 16x radixbuf insertion time.

Note: need to subtract "clone" time from "lookup" to get meaningful values
about "lookup". This cannot be done automatically due to the limitation of the
benchmark framework.

Although it's slower than radixbuf, the index is still faster than gdbm and
rocksdb. Note: the index does less than gdbm/rocksdb since it does not return
a `[u8]`-ish which requires extra lookups. So it's not a very fair comparison.

  gdbm insertion          time:   [69.607 ms 75.102 ms 79.334 ms]
  gdbm lookup             time:   [9.0855 ms 9.8480 ms 10.637 ms]
  gdbm prepare            time:   [110.35 us 120.40 us 135.63 us]
  rocksdb insertion       time:   [117.96 ms 123.42 ms 127.85 ms]
  rocksdb lookup          time:   [24.413 ms 26.147 ms 28.153 ms]
  rocksdb prepare         time:   [3.8316 ms 4.1776 ms 4.5039 ms]

Note: Subtract "prepare" from "insertion" to get meaningful values.

Code to benchmark rocksdb and gdbm:

```
extern crate criterion;
extern crate gnudbm;
extern crate rand;
extern crate rocksdb;
extern crate tempdir;

use criterion::Criterion;
use gnudbm::GdbmOpener;
use rand::{ChaChaRng, Rng};
use rocksdb::DB;
use tempdir::TempDir;

const N: usize = 20480;

/// Generate random buffer
fn gen_buf(size: usize) -> Vec<u8> {
    let mut buf = vec![0u8; size];
    ChaChaRng::new_unseeded().fill_bytes(buf.as_mut());
    buf
}

fn criterion_benchmark(c: &mut Criterion) {
    c.bench_function("rocksdb prepare", |b| {
        b.iter(move || {
            let dir = TempDir::new("index").expect("TempDir::new");
            let _db = DB::open_default(dir.path().join("a")).unwrap();
        });
    });

    c.bench_function("rocksdb insertion", |b| {
        let buf = gen_buf(N * 20);
        b.iter(move || {
            let dir = TempDir::new("index").expect("TempDir::new");
            let db = DB::open_default(dir.path().join("a")).unwrap();
            for i in 0..N {
                db.put(&&buf[20 * i..20 * (i + 1)], b"v").unwrap();
            }
        });
    });

    c.bench_function("rocksdb lookup", |b| {
        let dir = TempDir::new("index").expect("TempDir::new");
        let db = DB::open_default(dir.path().join("a")).unwrap();
        let buf = gen_buf(N * 20);
        for i in 0..N {
            db.put(&&buf[20 * i..20 * (i + 1)], b"v").unwrap();
        }
        b.iter(move || {
            for i in 0..N {
                db.get(&&buf[20 * i..20 * (i + 1)]).unwrap();
            }
        });
    });

    c.bench_function("gdbm prepare", |b| {
        let buf = gen_buf(N * 20);
        b.iter(move || {
            let dir = TempDir::new("index").expect("TempDir::new");
            let _db = GdbmOpener::new().create(true).readwrite(dir.path().join("a")).unwrap();
        });
    });

    c.bench_function("gdbm insertion", |b| {
        let buf = gen_buf(N * 20);
        b.iter(move || {
            let dir = TempDir::new("index").expect("TempDir::new");
            let mut db = GdbmOpener::new().create(true).readwrite(dir.path().join("a")).unwrap();
            for i in 0..N {
                db.store(&&buf[20 * i..20 * (i + 1)], b"v").unwrap();
            }
        });
    });

    c.bench_function("gdbm lookup", |b| {
        let dir = TempDir::new("index").expect("TempDir::new");
        let mut db = GdbmOpener::new().create(true).readwrite(dir.path().join("a")).unwrap();
        let buf = gen_buf(N * 20);
        for i in 0..N {
            db.store(&&buf[20 * i..20 * (i + 1)], b"v").unwrap();
        }
        b.iter(move || {
            for i in 0..N {
                db.fetch(&&buf[20 * i..20 * (i + 1)]).unwrap();
            }
        });
    });
}

criterion_group!{
    name=benches;
    config=Criterion::default().sample_size(20);
    targets=criterion_benchmark
}
criterion_main!(benches);
```

Reviewed By: DurhamG

Differential Revision: D7404532

fbshipit-source-id: ff39f520b78ad1b71eb36970506b313bb2ff426b
2018-04-13 21:51:40 -07:00
Jun Wu
5576402ea9 indexedlog: add ability to clone a Index object
Summary:
This will be useful for benchmarks - prepare an index as a template, and
clone it in the tests.

Reviewed By: DurhamG

Differential Revision: D7422835

fbshipit-source-id: 190bbdee7cb7c1526274b4d4dab07af4984b5df6
2018-04-13 21:51:40 -07:00
Jun Wu
2f30189748 indexedlog: reorder "use"s
Summary:
The latest rustfmt disagrees about the order of `std::io` imports. Move the
troublesome line to a separate group so both the old and new rustfmt agress
on the format.

Reviewed By: DurhamG

Differential Revision: D7422834

fbshipit-source-id: 9f5289ef2af1a691559fe691e121190f6d845162
2018-04-13 21:51:40 -07:00
Jun Wu
704eef1e4e radixbuf: use criterion for benchmark
Summary:
The old `rustc-test` crate no longer works. There is an upstream
bug report at https://github.com/servo/rustc-test/issues/7.

This change makes it possible to compare radixbuf performance
with the new index.

Reviewed By: DurhamG

Differential Revision: D7404531

fbshipit-source-id: 515e732a65388db4c865c7b139d0f57ead76f788
2018-04-13 21:51:40 -07:00
Jun Wu
9672c45582 indexedlog: add a test comparing with std HashMap
Reviewed By: DurhamG

Differential Revision: D7404529

fbshipit-source-id: a52da9aa9661b48eefc015ce351886677f842d66
2018-04-13 21:51:40 -07:00
Jun Wu
9077cbb5a7 indexedlog: reverse the writing order of radix entries
Summary:
Radix entries need to be written in an reversed order given the order they
are added to the vector.

Reviewed By: DurhamG

Differential Revision: D7404530

fbshipit-source-id: 403189b5c0fa6f21183e62eea04ce4ce7c4e1129
2018-04-13 21:51:40 -07:00
Jun Wu
2075ad87c2 indexedlog: implement leaf splitting
Summary: Complete the insertion interface.

Reviewed By: DurhamG

Differential Revision: D7377210

fbshipit-source-id: 96645ac03a3fd65f22d9a9a54d8479715f49e67d
2018-04-13 21:51:39 -07:00
Jun Wu
a436d0554d indexedlog: add more helper methods
Summary: Those little read and write helpers are used in the next diff.

Reviewed By: DurhamG

Differential Revision: D7377214

fbshipit-source-id: c6e2d240334c11a0b08b15cd7d5c114b6f4d8ace
2018-04-13 21:51:39 -07:00
Jun Wu
61bf1f3854 indexedlog: add a helper function to get key content
Summary:
Add a helper function `peek_key_entry_content` that checks key type and
return the key content.

Reviewed By: DurhamG

Differential Revision: D7377211

fbshipit-source-id: 0ce509aba30309373a709cf5fbcb909dd80471dc
2018-04-13 21:51:39 -07:00
Jun Wu
bf55572f78 indexedlog: partially implement insertion
Summary:
Implement insertion when there is no need to split a leaf entry.

The API may be subject to change if we want other value types. For now, it's
better to get something working and can be benchmarked so we have data about
performance impact with new format changes.

Reviewed By: DurhamG

Differential Revision: D7343423

fbshipit-source-id: 9761f72168046dbafcb00883634aa7ad513a522b
2018-04-13 21:51:39 -07:00
Jun Wu
2389fd95c0 indexedlog: add helper methods about writing data
Summary:
Like the `peek_` family of helper methods. Those methods handles writing
data for both dirty (in-memory) and non-dirty (on-disk) cases. They will
be used in the next diff.

Reviewed By: DurhamG

Differential Revision: D7377208

fbshipit-source-id: f458a20da4bb7808f37daeed3077be2f7e90a9df
2018-04-13 21:51:39 -07:00
Jun Wu
cb58628046 indexedlog: add debug formatter
Summary:
Add code to print out Index's on-disk and in-memory entries in
human-friendly form. This is useful for explaining its internal state, so it
could be used in tests.

Reviewed By: DurhamG

Differential Revision: D7343427

fbshipit-source-id: 706a35404ea42c413657b389166729f8dd1315a3
2018-04-13 21:51:39 -07:00
Jun Wu
a3f7ec3f9b indexedlog: fix root entry serialization
Summary:
Offset stored in it needs to be translated, as done in other types of
entries.  I forgot it.

Reviewed By: DurhamG

Differential Revision: D7404528

fbshipit-source-id: fb09a9c3052ddfe8f8016440290062084d5d8b03
2018-04-13 21:51:39 -07:00
Jun Wu
fcc71af3ab indexedlog: add API to find link offset from a key
Summary:
This is a low-level API that follows the base16 sequence of a key, and
return potentially matched `LinkOffset`.

Reviewed By: DurhamG

Differential Revision: D7343424

fbshipit-source-id: 38f260064d1a23695a28dda6f7dc921f88c7fccc
2018-04-13 21:51:39 -07:00
Jun Wu
871ca6c96b indexedlog: add helper methods to read data
Summary:
Add a bunch of helper methods to "peek" data inside all kinds of entries.
They will be used in the next diff.

The benefit of those helper methods is they handle both dirty offsets and
non-dirty offsets transparently. Previously I have tried to always parse
on-disk entries into in-memory ones and stored them in a hashmap cache.
But that turned to have too much overhead so always reading from disk is
more desirable. It seems to provide at least 2x perf improvement from my
previous quick test.

Reviewed By: DurhamG

Differential Revision: D7377207

fbshipit-source-id: 1b393f1fe64c1d54b986ba7c3b03c790adb694d4
2018-04-13 21:51:39 -07:00
Jun Wu
983d6920f5 indexedlog: add a non-dirty helper method
Summary:
The `non_dirty` helper method enforces the offset to be a non-dirty one.
It will be used frequently for checking offsets read from the disk, since
the on-disk offsets shouldn't have any reference to dirty (in-memory)
entries.

Reviewed By: DurhamG

Differential Revision: D7377209

fbshipit-source-id: c6c381c065d3ba8aaa65698224e4778b86edbc4a
2018-04-13 21:51:39 -07:00
Jun Wu
f0b5cd6eae indexedlog: add simple DirtyOffset abstraction
Summary: The `DirtyOffset` enum converts between array indexes and u64.

Reviewed By: DurhamG

Differential Revision: D7377215

fbshipit-source-id: 29d4f7d74f15523034c11abcc09329a1b21142b1
2018-04-13 21:51:39 -07:00
Martijn Pieters
bf9eb9018e sparse: add the option to hide certain profiles
Summary:
Some profiles are not for general consumption; they are usually profiles aimed at CI subsystems or similar. These can be hidden from listings by default using a `hidden` key.

The value of the key doesn't matter but can be used to explain why it is hidden.

Reviewed By: quark-zju

Differential Revision: D7433781

fbshipit-source-id: 877cd8698d50dc64cec8da706ab005e1fd786de4
2018-04-13 21:51:39 -07:00
Martijn Pieters
b9cca4a62b sparse: rework help information
Summary:
The hg sparse help page was overwhelming, and out of date. With subcommands, we
can break up the information a bit more.

* Subcommand help is the place for details on that command. Reduce the main
  help info to an overview.
* Move configuration switches to a `verbose` container to hide it by default.
* Add documentation on the sparse profile format.
* Mark the command-line switches with subcommands as deprecated so they are
  hidden by default.

Reviewed By: quark-zju

Differential Revision: D7432862

fbshipit-source-id: ffddd27e0ee4216f7e743e63e8efaed4eeaac582
2018-04-13 21:51:38 -07:00
Martijn Pieters
a4952f4bfa sparse: add a hg sparse files command
Summary: This command mostly echoes how `hg files` works, albeit simplified somewhat. Given a profile and optional patterns, the files that profile matches are listed.

Reviewed By: quark-zju

Differential Revision: D7431522

fbshipit-source-id: 8e9d1f0d2aa31335f53269f3005875a0cc2e65bf
2018-04-13 21:51:38 -07:00
Martijn Pieters
4c93c15316 sparse: include sparse profile impact
Summary:
Show the 'impact' of a profile, relative to a non-sparse working copy.

By default, this is the percentage of the total file count; adding --verbose will show the file sizes too.

The defined matchers have been refactored to reuse more of mercurial.match.basematcher, making it easier to reuse these in a wider mercurial context and avoiding repetition of common methods.

Reviewed By: quark-zju

Differential Revision: D7415720

fbshipit-source-id: 4ac3492c61aa70ee71d4bdf8c201b905a345a9d1
2018-04-13 21:51:38 -07:00
Martijn Pieters
aacd20f02b remotefilelog: add a spinner when finding outgoing revisions
Summary: On my system, the `outgoing()` revset could easily take several seconds. A spinner here helps dispell the notion that mercurial has hung.

Reviewed By: quark-zju

Differential Revision: D7429086

fbshipit-source-id: 28908a34798d985dad3120647c3a5f474ca8a746
2018-04-13 21:51:38 -07:00
Durham Goode
6ada5becf6 hg: fix stripping trees that were changed in merge commits
Summary:
Previously we relied on the list of files created by strip to decide
what directories to strip. It turns out this list wasn't adequate though, since
it's possible for directories to change even when files do not. For example,
during a merge if different files were added on different sides of the merge,
the files don't change during the merge but their containing directory does.

This diff special cases merge commits to make sure all the directories affected
by the merge are included in the strip.

Reviewed By: quark-zju

Differential Revision: D7409156

fbshipit-source-id: 9bf67eefb70189300c29db60d9945a7f608dfdda
2018-04-13 21:51:38 -07:00
Durham Goode
f5b8d91797 hg: fix sending trees from the server to non-tree clients
Summary:
Previously we were trying to send trees to all clients during an
infinitepull, even ones that didn't support treemanifest. This caused
infinitepulls that required rebundling to fail for non-tree clients.

The fix is to just not send them unless the client is advertising the
capability.

Reviewed By: phillco

Differential Revision: D7432374

fbshipit-source-id: 1fae14a158ef56fe39439a718b1b98928f4e07b0
2018-04-13 21:51:38 -07:00
Martijn Pieters
78965e53ca sparse: fix flakey test
Summary: The order of the two reported files can differ, depending on the random hash seed.

Reviewed By: ryanmce

Differential Revision: D7427725

fbshipit-source-id: 9ec76867877553a02d1a19642d98d626b0ba91cc
2018-04-13 21:51:38 -07:00
Martijn Pieters
fcdfdd9931 simplecache: refactor to allow just getting or setting, split out jsonserializer
Summary:
I need to be able to test for the presence of a cache without the ability to use a function, and I rather not use a sentinel value or have func raise an exception.

Note that the extension already is vulnerable to race conditions (there is plenty of time between the get, the func() call, and the set as it is).

Also, make it trivial to use JSON as a serializer.

Reviewed By: quark-zju

Differential Revision: D7415721

fbshipit-source-id: dc06e8f3efe725858a7960f7acfecc5a60390b85
2018-04-13 21:51:38 -07:00
Martijn Pieters
96a6a5773d sparse: make hg help sparse <subcommand> work
Summary:
This gives us access to the specifics of a subcommand, including switches
(still stubbed out). Note: `hg sparse <subcommand> -h` doesn't work yet, as the
`-h` command line switch would need intercepting as well.

Reviewed By: quark-zju

Differential Revision: D7413859

fbshipit-source-id: 02534f1255a11985ebe8636b26946fbeffc6fe09
2018-04-13 21:51:38 -07:00
Mark Thomas
449b58b48d progress: implement formatting of bytes values
Summary:
Add the ability to set a `formatfunc` on a progres bar, which formats the
numbers used.  Use `util.bytecount` as a format function in the places
where we have progress bars in numbers of bytes.

Reviewed By: quark-zju

Differential Revision: D7355232

fbshipit-source-id: 117c7035d46d47259cdfd70b80438cc6f4615977
2018-04-13 21:51:38 -07:00
Aida Getoeva
c752c3c3d5 Obsolete markers inside crdump
Summary: Added obsolete markers for each revision into `hg debugcrdump` output

Reviewed By: ryanmce

Differential Revision: D7416991

fbshipit-source-id: 9cca7339a4c465c5df81f2646e2ad0ce87bd2c3d
2018-04-13 21:51:38 -07:00
Mark Thomas
dbf70dc3fd crecord: suspend progress bar when displaying the curses interface
Summary:
Nothing currently displays a progress bar while the curses interface is shown,
but in the future something may be added which does, so ensure the progress bar
is suspended when showing the curses interface.

Reviewed By: ryanmce

Differential Revision: D7417435

fbshipit-source-id: 6b91b17ee5390cbde6e983081a0940051ab865c8
2018-04-13 21:51:38 -07:00
Mark Thomas
633d10fe2b ui: suspend progress bars when prompting the user
Differential Revision: D7416038

fbshipit-source-id: dbf4132c646c9b70a8d240cf2aa6e9eea53501a9
2018-04-13 21:51:37 -07:00
Martijn Pieters
84bfcf3162 RFC: sparse: ignore case collisions outside the sparse profile
Summary:
When updating a working copy that is limited by a sparse profile, do not abort on case collisions outside of the current working copy view.

Performance-wise, this isn't a big change; previously `_checkcollision()` would convert the whole manifest to a set, now we filter first with the matcher, then convert the remainder to a set. Either the original set conversion or the filtering can take O(size-of-manifest) time.

Reviewed By: ryanmce

Differential Revision: D7350251

fbshipit-source-id: efb8e270631f0aaa75c34c7b68189c60efe45984
2018-04-13 21:51:37 -07:00
David Soria Parra
f2f32df45b p4fastimport: pass ui to progress.bar
Summary: progress.bar() is incorrectly called without passing ui.

Differential Revision: D7415250

fbshipit-source-id: 22c7419561879ed9293e2c79cc9d4271e805be76
2018-04-13 21:51:37 -07:00
Liubov Dmitrieva
3ab4155a04 obsshelve: bugfix with old format shelves
Summary:
fix bug with new shelved() revsetpredicate

it failed if old format shelve files were present

Differential Revision: D7414883

fbshipit-source-id: 7b96abe7abf950ba339c22d0e9025f7423004911
2018-04-13 21:51:37 -07:00
Saurabh Singh
4c60397d1f test-fb-hgext-obsshelve: use shell function instead of alias
Summary:
D7397947 broke `test-check-code.t` which complains about the use of
alias instead of function. This is blocking our continuous builds. This commit
addresses the same.

Reviewed By: quark-zju

Differential Revision: D7404361

fbshipit-source-id: 7907e913327c77861258a37ff8b87d467a7a15c6
2018-04-13 21:51:37 -07:00
Phil Cohen
26476a8a58 add megarepo generation script
Summary: This script can be used to generate a large number of commits.

Reviewed By: DurhamG

Differential Revision: D7363243

fbshipit-source-id: 1a1e3ba7fca29dc695446eeffb715474ea2943ad
2018-04-13 21:51:37 -07:00
Durham Goode
78f6364280 hg: check if treemanifest is enabled in more places
Summary:
In uisetup we wrap a bunch of functions. We need to make sure they each
handle the case where treemanifest is not actually enabled for that repo. This
can happen in cases like a peer-to-peer pull where one repo has treemanifest
enabled and one does not.

Reviewed By: quark-zju

Differential Revision: D7368084

fbshipit-source-id: 152a448fb8a902e8c8f8ac4e806ab53514fadaa7
2018-04-13 21:51:37 -07:00
Martijn Pieters
6414c84571 sparse: show individual profile details
Summary: This shows basic details about a template, including base metadata. Once we have support for per-subcommand switches we can add further filtering.

Reviewed By: ryanmce

Differential Revision: D7365794

fbshipit-source-id: 3dd362f099e7f4d6db73c9bda7c24a9f4f2f90ee
2018-04-13 21:51:37 -07:00
Martijn Pieters
422a95de10 sparse: provide subcommands for other common tasks
Summary: Now all commands can be subcommands. The command-line switches will be hidden in a next commit (but remain available for backwards compatibility).

Reviewed By: ryanmce

Differential Revision: D7365393

fbshipit-source-id: 29b8ed2ac6bffccda41ed3f738087dde23312a8c
2018-04-13 21:51:37 -07:00
Martijn Pieters
5296ef905b sparse: make the help system print our subcommands
Summary:
This means we can

- count on the minirst module to format longer lines correctly,
- show subcommands when an error occurs (so full is false),
- add verbose help when the -v switch

Reviewed By: ryanmce

Differential Revision: D7365392

fbshipit-source-id: c8711bd19a6d992ad86f24f3c07b381f69d02121
2018-04-13 21:51:37 -07:00
Martijn Pieters
b8110f185c Allow for better help handling and multiple registrations for a single function.
Summary:
We take help info from the docstring but that'd disallow multiple registrations for a single function that can handle multiple subcommands. Refactor to let the decorator set an override.

So before you'd do this:

```
subcmd('foo')
def _foocmd(...):
    "Help for foo command"
    # implementation for foo

subcmd('bar')
def _barcmd(...):
    "Help for bar command"
    # implementation for bar
```
but you could not *combine* the implementations into one function and decorate both, because there is only the single docstring.

Now you can do:

```
subcmd('foo', help="Help for foo command")
subcmd('bar', help="Help for bar command")
def _fooandbarcmd(cmd, ...):
    "This docstring is no longer used"
    # implementation for foo and bar, combined, switching on the value of cmd
```

Reviewed By: ryanmce

Differential Revision: D7365390

fbshipit-source-id: 3d41542f1f197137ef13458e8d850cda8f53da74
2018-04-13 21:51:37 -07:00
Martijn Pieters
c9dd45c81f help: refactor to allow for patching
Summary:
I want to add to helpcmd but with nested functions that's a lot more
complicated then it needs to be.

Reviewed By: ryanmce

Differential Revision: D7365391

fbshipit-source-id: 02092dd55f8f9521324b8ed51fa3134817454d36
2018-04-13 21:51:37 -07:00
Liubov Dmitrieva
ee6457a0fb obsshelve: add highlight
Summary:
obsshelve: highlight shelved changes in smartlog (you can see with --hidden)

we highlighted only active shelved changes, those that has been unshelved are just ordinary hidden changes.

Reviewed By: ryanmce

Differential Revision: D7383800

fbshipit-source-id: 2df4092514d58315a6a204411feed99819df5c93
2018-04-13 21:51:36 -07:00
Liubov Dmitrieva
58b4fc9380 obsshelve: add tests for new revsetpredicate
Summary: obsshelve: add tests for new revsetpredicate

Differential Revision: D7397947

fbshipit-source-id: f2940ef20e594aea93832860a3dccfa2c4cf787a
2018-04-13 21:51:36 -07:00