Commit Graph

32 Commits

Author SHA1 Message Date
Stanislau Hlebik
932d143025 smartlog: do not draw public commits between draft commits and master
Summary:
We've seen a couple of issues when there are lots of public commits between a
head and master bookmark. Smartlog tries to draw all of the public commits
and drawing it can be too slow. See example below

```
   o - some commit that smartlog wants to draw
  /
o
.
.    -- many commits
.
o  - master bookmarks
```

This issue happens often while using infinitepush extension.
Let's fix it by drawing just one public commit between a head and master.
We could of course avoid drawing this public commit at all, but in that case
output would be smth like

```
   o - some commit that smartlog wants to draw
  /
o
|     - many commits in betwee, but user doesn't see it because there are no dots
o  - master bookmarks
```

Test Plan: Slowly run tests

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D168
2017-07-21 07:10:08 -07:00
Felix Merk
82603807d7 undo: meaningful obs markers for undos
Makes obs markers for undos more meaningful.  When an undo performs a strict one
to one change, the written obs marker reflects that and the user even gets a
helpful ui message in smartlog.  One to many undos do not support such obs
markers (currently) because we can't tell splits and divergence apart easily.

Differential Revision: https://phab.mercurial-scm.org/D108
2017-07-19 17:49:21 -07:00
Mateusz Kwapich
fa73f071b8 tests: one new temaplate in the tests message
Summary:

Reviewers: quark

Reviewed By: quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D44
2017-07-11 09:44:53 -07:00
Mateusz Kwapich
760d982e3e tests: change the name of backup files
Summary: Looks like the upstream has changed it on us.

Reviewers: quark

Reviewed By: quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D40
2017-07-11 09:44:53 -07:00
Jun Wu
ce21516db2 smartlog: use dagop.reachableroots
97fbbbc2ac35 moved reachableroots from revset to dagop.
2017-06-20 13:58:40 -07:00
Felix Merk
88a744be9e smartlog: let smartlog revset take recentday argument
Summary: Add an optional `recentdays` parameter to smartlog revset.

Test Plan: Added test to test-smartlog.t

Reviewers: #mercurial, durham, quark

Reviewed By: quark

Subscribers: durham, stash, mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5211513

Tasks: 19179819

Signature: t1:5211513:1497487196:f7d59ec32c09680ed769977890f3031369f7652e
2017-06-15 10:06:09 -07:00
Jun Wu
3ed8d7b512 smartlog: add a simple ancestor cache
Summary:
`revlog.ancestor` is expensive on long changelog, but is only called a few
(about 30) times for smartlog usage. Therefore we could simply cache the
result in a key-value database.

This speeds up smartlog by about 200ms.

Test Plan: Added a new test

Reviewers: #mercurial, stash

Reviewed By: stash

Subscribers: stash, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5135746

Signature: t1:5135746:1495783503:411260551fd29fda42c9fc809b56f8f77fb2eaf4
2017-05-26 09:03:58 -07:00
Jun Wu
763e41cee8 smartlog: work better with repos where there is no master
Summary:
Previously, smartlog use `tip` as the fallback master, and prompts:

  warning: there is no master changeset locally, try pulling from server

if master is `tip`.

That makes smartlog less friendly for external users. This patch removes the
prompt and changes the fallback master to the last public revision so it
works out-of-box.

Test Plan: `arc unit`

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4555346

Signature: t1:4555346:1487036530:35a5fa65d5419e7324d3203fa52de9a82b8132e3
2017-02-14 17:25:12 -08:00
Adam Simpkins
63b7bb19c5 templates: fix help messages for template keywords
Summary:
Many of the template keywords in our extensions were being registered
incorrectly, causing their help output to be rendered incorrectly in the
"hg help templates" output.  The ones in smartlog.py were particularly bad, as
most of them showed only their description, without displaying the name of the
template.  In smartlog.py only singlepublicsuccessor was being displayed
correctly, because it's docstring explicitly included it's own name at the
start.

This fixes all of our extensions to consistently use the
registrar.templatekeyword() decorator to register the keywords.  This decorator
automatically prefixes the help message with the keyword name.  The
mercurial/extensions.py code will explicitly check to see if an extension
contains an "templatekeyword" attribute, and if so it will register any
keywords contained in this registry after calling extsetup().

Test Plan:
Added new unit tests to check the output of "hg help templates" for the
affected keywords.

Reviewers: #sourcecontrol, kulshrax, ikostia, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, net-systems-diffs@, yogeshwer, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4427729

Signature: t1:4427729:1484831476:17b478a5e867dfc3f85402588c381bf8b1831107
2017-01-19 12:52:54 -08:00
Jun Wu
efb6a83a3e smartlog: remove unused edge when indentnonpublic is set
Summary:
This patch removes the unused line and space so it looks a bit better:

```
 .
 .
 .
 | o          o
 | |          |
 | |          |
 | o          o
 |/          /
 |          |
 o          o
 .          .
 .          .
(before)   (after)
```

Due to the current implementation of graphlog, it's a bit hacky to achieve the
above effect.

Test Plan: Run `test-smartlog*.t`

Reviewers: #mercurial, ttung, mjpieters, durham

Reviewed By: durham

Differential Revision: https://phabricator.intern.facebook.com/D3881516

Signature: t1:3881516:1475170264:477c66b2372d04c4e5d7c8fbb69de30599706e5d
2016-09-17 02:22:36 +01:00
Jun Wu
aaafeda370 smartlog: use graphstyle.grandparent to draw ellipsis
Summary:
Now that the graph module can draw "..." for grand parents, it's no longer
to have fake nodes for that purpose. Remove most fake node related logic.

This will make the output more compact.

Note that the fake node is still used for "indentnonpublic" and its output
is slightly changed to display an "o" node, which will be fixed in the next
diff.

Since we now rely on a recent version of mercurial, remove some "inspect"
check for ancient mercurial support.

Test Plan: Run the modified `test-smartlog.t` and other `test-smartlog*.t`.

Reviewers: #mercurial, ttung, durham

Reviewed By: durham

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3880771

Signature: t1:3880771:1474306496:3400c70efbb569c5096e724720ead1992b87f160
2016-09-17 00:51:26 +01:00
Jun Wu
dfa3d19fc2 smartlog: add an option to indent the non-public stack at the top
Summary:
One thing that may confuse new users is that when draft changesets are on top
of public changesets:

```
o draft
|
o remote/master
```

It's unclear whether the draft changeset is already in the master branch, or not.

This diff adds an option to move the drafts to the second column to indicate they
are not part of master.

Test Plan: Run `test-smartlog.t`

Reviewers: ttung, durham, #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3876951

Signature: t1:3876951:1474043568:c97b26b49917f36a5197af93ea386658b91d56a4
2016-09-16 16:36:10 +01:00
Jun Wu
9fea0c3f0c doc: replace "commit" where it is used as a noun with "changeset"
Summary:
"changeset" is a more official term and let's use it. Note that this patch
only changes documentation / i18n messages visible to the users and header
comment blocks to developers. Other places like comments in the code are
untouched.

With the "dialect" extension enabled, users will still see the more friendly
term - "commit".

Test Plan:
`arc unit`. Note the remotefilelog failure is probably unrelated - seems
related to ongoing / upcoming manifest refactoring upstream.

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3900394

Signature: t1:3900394:1474470348:6a1b5691e2599cc47df18b227d56d1f9d3c7c906
2016-09-21 15:45:25 +01:00
Jun Wu
8a3a99ba21 hgext: move single file extensions to hgext3rd
Summary:
Be a better citizen under system python path.

Fix all tests issues and change setup.py to use glob pattern to include
all extensions.

Test Plan:
Run tests and `make local`.
Also build and install the package and run `hg sl` in major repos.

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, durham, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3534311

Signature: t1:3534311:1468275426:fe122646c8bd6c541e1889e73e9df28f86747ff2
2016-07-08 13:15:42 +01:00
Martijn Pieters
58d4cb362d Fix graphmod-related test failures
Summary:
This change fixes up tests to track graphmod changes.

The change for the smartlog test is a temporary stop-gap measure, as smartlog
itself will be updated soon to track the changes in better ways.

Test Plan:
Run the test-suite, ignore unrelated failures in test-morestatus.t, test-mergedriver.t
and test-fastmanifest.t

Reviewers: #sourcecontrol, ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.fb.com/D3191336

Tasks: 10804976
2016-04-19 11:19:20 +01:00
Mateusz Kwapich
6f8286e7c1 smartlog: first citizen support the multiple roots in the repo
Summary:
This replaces the dirty hack preventing the smartlog from crashing on repo with
multiple roots with proper logic finding common ancestors one per group of
commits with the same root.

Test Plan: unit tests

Reviewers: #sourcecontrol, mjpieters, durham, ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.fb.com/D3119913
2016-03-31 11:26:15 -07:00
Mateusz Kwapich
654ead9d1f make smartlog not crash when having two histories in the repo
Summary:
Quick fix for smartlog to make it work when having to separate repositories in the repo.
It's not perfect (it shows the second history before master) but it's better than nothing.

Test Plan: All tests are passing . One test added.

Reviewers: #sourcecontrol, durham, ttung, ericsumner

Reviewed By: durham

Subscribers: mjpieters, durham

Differential Revision: https://phabricator.fb.com/D2904476

Tasks: 9812246

Signature: t1:2904476:1455239810:9f88d87b15646bfd107f0b1dc888804d392c35da
2016-02-11 17:31:42 -08:00
Kostia Balytskyi
dbc07b1275 smartlog: add singlepublicsuccessor template keyword
Differential Revision: https://phabricator.fb.com/D2926819
2016-02-11 07:11:59 -08:00
Mat Wood
83adb89ac4 Fixing smartlog errors on empty repo
Summary: An empty repo will cause the smartlog extension to have errors. SCM is trying to iterate through an empty dataset. Smartlog needs to catch the exception and abort if the current repo is empty.

Test Plan: Added tests to make sure 'hg smartlog' on a newly created repo doesn't explode. Confirmed that tests failed before the fix, and they pass with the fix in place.

Reviewers: cdelahousse, jetzhao, romanchadnov, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, ericsumner

Differential Revision: https://phabricator.fb.com/D2446132

Tasks: 8118567

Signature: t1:2446132:1442512709:6a666351a02639f6e0b15c6c7476a8cdd25370c9
2015-09-15 16:13:13 -07:00
Durham Goode
ddcf826f81 smartlog: fix masterrev supporting funky bookmark names
Summary:
The master revset config was not using scmutil.revrange/revsingle so it wasn't
able to handle bookmark names like 'foo-bar'. Let's use them.

Test Plan: Added a test

Reviewers: rmcelroy, sid0, lcharignon, ericsumner

Differential Revision: https://phabricator.fb.com/D2082328

Tasks: 7116971
2015-05-18 17:36:21 -07:00
Durham Goode
be069ac108 smartlog: switch to using scmutil.revrange
Summary:
The smartlog rev option wasn't resolving names right because it used
the wrong internal api. Fixes that.

Test Plan: Adds a test

Reviewers: lcharignon, pyd

Reviewed By: pyd

Differential Revision: https://phabricator.fb.com/D2033646

Signature: t1:2033646:1430346864:be69cfb5fe3892f51340546b1fbb341fabfffe14
2015-04-29 15:00:31 -07:00
Ryan McElroy
a16275745c merge from default 2015-02-24 11:51:16 -08:00
Ryan McElroy
01936c5c53 smartlog: fix crash with non-public branches
Summary:
Previously smartlog failed when a branch head was not public.
Fix this and add a test to prevent regression.

Test Plan: New test, ./run-tests.py

Reviewers: ericsumner, sid0, mitrandir, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1866905

Tasks: 6120552

Signature: t1:1866905:1424799838:51d5f8501b20dc3757f825ba8a13d38eccec0bff
2015-02-23 22:54:08 -08:00
Ryan McElroy
264dbf8ad6 smartlog: centralize master option lookup
Test Plan: ```./run-tests.py --with-hg=$(which hg) -j 8```

Reviewers: durham, daviser, davidsp, mitrandir, ericsumner, pyd, sid0

Reviewed By: sid0

Differential Revision: https://phabricator.fb.com/D1859443

Tasks: 6274574

Signature: t1:1859443:1424455198:eeb81ecf0bd66c975b5c39b85710b6cd419912f2
2015-02-19 16:03:41 -08:00
Ryan McElroy
693b970149 smartlog: fix master ordering
Test Plan: ```./run-tests.py --with-hg=$(which hg) -j 8```

Reviewers: daviser, davidsp, mitrandir, ericsumner, pyd, durham, sid0

Reviewed By: sid0

Differential Revision: https://phabricator.fb.com/D1859437

Tasks: 6274574

Signature: t1:1859437:1424455215:f6a02deb5e2ad3cb57001da2dcba7d40fe9571e4
2015-02-19 15:50:16 -08:00
Ryan McElroy
dae96ce42f smartlog: factor out master revset calculation
Test Plan:
* Updated test

```
./run-tests.py --with-hg=$(which hg) -j 8
```

Reviewers: daviser, davidsp, mitrandir, ericsumner, pyd, sid0, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1859427

Tasks: 6274574

Signature: t1:1859427:1424479467:27b4a2ce644c97c04265b93e79332f169f78eda0
2015-02-19 14:39:54 -08:00
Eric Sumner
34002e0224 hgext: fix many tests, run-tests, writecg2 for hg3.3
Summary: Still need to fix pushrebase

Test Plan: ##run-tests.py##

Reviewers: sid0, daviser, davidsp, mitrandir, akushner, rmcelroy, pyd, mpm, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1813630

Signature: t1:1813630:1422573745:c5ea2a8acdfda0e555d1ae56a16f4fb5e5618174
2015-01-29 15:06:06 -08:00
Eric Sumner
a5c0bda96f merge from default 2015-01-22 11:34:42 -08:00
Eric Sumner
1c0fd006c9 smartlog: add revset function
Summary:
I wanted a way to see a commit in relation to the other smartlog entries, so
I refactored smartlog to provide a revset function for its default selections.

Test Plan: ##run-tests##

Reviewers: durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1794762

Tasks: 6057467

Signature: t1:1794762:1421888058:9b96d26f68b9b3bac24ef43db58fe8aa0299de37
2015-01-21 12:20:33 -08:00
Tiina Turban
07f9a3036f commit-info flag for smartlog
Summary: `hg sl/slog/smartlog` has a new flag `--commit-info`, which shows the files changed in currently active commit.

Test Plan:
Modified & added & removed a file to in commit.
The deleted, unknown, ignored and clean are not relevant, when we are talking about a change in a commit - right?

  hg sl
  hg sl --commit-info
  hg sl -T "blaa" --commit-info
  hg slog
  hg slog --commit-info
  hg slog -T "blaa" --commit-info

Commit-info flag adds info under current commit about the added, modified & removed files.

  hg sl --commit-info --stat
This looks weird as it shows the current commit changes twice. Should I care about this?

  #in fb-hgext/tests
  ./run-tests.py  test-smartlog.t

test passes.

Reviewers: sid0, pyd, davidsp, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1677101

Tasks: 5418936

Signature: t1:1677101:1415833805:975ce43aaaf1ccabe6a054d09a9e5f236447340f
2014-11-10 18:45:39 -08:00
Siddharth Agarwal
b4c11162d8 fix smartlog for Mercurial changes
Summary:
Use `first()` instead of `[0]`.

Also fix coloring under non-ANSI terminals (required to get the test working).

Test Plan: Ran the tests. Also ran `hg sl` with this in a few of my repos.

Reviewers: durham, davidsp, akushner, daviser, rmcelroy, pyd

Reviewed By: pyd

Differential Revision: https://phabricator.fb.com/D1623808

Tasks: 5375006
2014-10-17 13:35:52 -07:00
Siddharth Agarwal
7a87af3b49 fix smartlog for Mercurial changes
Summary:
Use `first()` instead of `[0]`.

Also fix coloring under non-ANSI terminals (required to get the test working).

Test Plan: Ran the tests. Also ran `hg sl` with this in a few of my repos.

Reviewers: durham, davidsp, akushner, daviser, rmcelroy, pyd

Reviewed By: pyd

Differential Revision: https://phabricator.fb.com/D1623808

Tasks: 5375006
2014-10-17 13:35:52 -07:00