Commit Graph

515 Commits

Author SHA1 Message Date
Saurabh Singh
f86c1f069f stat: template which outputs diffstat-style summary of changes
Summary:
There is an existing template "diffstat" which gives a minimal and not
very useful output containing the overall number of files that changed, total
number of lines inserted for all associated files, and total number of lines
deleted for all associated files.

On the other hand, the output from the command line option "stat" is much more
descriptive. Therefore, users end up using commands of the form



  hg log -r . -T '{author}{date}' --stat



When they would have preferred something like



    hg log -r . -T '{author}{date}{stat}'



This change adds the template "stat" which will allow for the desired behavior.

Test Plan:
  # Added a new test test-template-stat.t
  # Ran arc unit

Reviewers: #sourcecontrol, quark

Reviewed By: quark

Subscribers: akushner, medson, mjpieters, quark, rmerizalde

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

Tasks: 12422741

Signature: t1:5521665:1501287682:2afaea56b3dc863c52e6300c6bc482ae132a6a61
2017-07-31 11:09:50 -07:00
Zhihui Huang
784c334b8e p4fastimport: handle race condition in git fusion commits
Summary:
When a user commits changes to a git-fusion repo, it pushes commit to perforce as user git-fusion-user, and then update the commit's author to be the actual author. We want p4fastimporter to skip the git-fusion-user commit and import the commit by the actual author. This diff sets the basic workflow, where we specify the constraint to be commits by git-fusion-user that is less than 30 seconds old.
// TODO: make the constraint configurable.

Test Plan:
$ cd ~/facebook-hg-rpms/fb-hgext/tests/
// test race condition
$ python ../../hg-crew/tests/run-tests.py test-p4fastimport-gitfusion-race-condition.t
// test all
$ python ../../hg-crew/tests/run-tests.py test-p4*

Reviewers: #idi, davidsp

Reviewed By: davidsp

Subscribers: medson, mjpieters

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

Tasks: 20141882

Signature: t1:5509536:1501521842:17dd767615b8218980eda68d4113433d30805d92
2017-07-31 11:06:31 -07:00
Durham Goode
ab78eca81d perftweaks: add logging for rebase size
Summary:
Let's add logging for the size of rebases (the number of commits being rebased
and the distance over which they are rebased).

Test Plan: Ran a rebase and saw the data show up in ptail

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Subscribers: stash, quark, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D169
2017-07-31 10:57:44 -07:00
Durham Goode
dcf434110d perftweaks: add update sizes to logging
Summary:
Let's log the number of commits we're traversing and the number of files
changed by an update.

Test Plan:
Ran it with --config
sampling.key.update_size=perfpipe_dev_command_timers and watched the entry show
up via ptail

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D166
2017-07-31 09:57:23 -07:00
Mateusz Kwapich
502f666449 metaedit: switch to scmutil.cleanupnodes for cleanup
Summary:
That switches us to use the higher level abstractions and allows us to
beneefit from things like showupdated (see: D173)

Test Plan: ran metaedit tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D191
2017-07-31 08:52:22 -07:00
Stanislau Hlebik
b88304992e fastlog: show all hg log output even if fastlog request failed
Summary:
We had a few troubles where fastlog failed with a weird error and people got
incorrect log output. While I still don't know why fastlog failed in the first
place, I've found the reason why log output was truncated. And this diff fixes
it. See the comments in the code for details.

Test Plan: Run unit-test

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Subscribers: simonfar

Differential Revision: https://phab.mercurial-scm.org/D193
2017-07-31 00:58:55 -07:00
Kostia Balytskyi
6203a99ed4 sparse: also apply relative-path logic to --delete
Summary: Add `--delete` to the list of sparse options that understand cwd-relative paths.

Test Plan: rt

Reviewers: mjpieters, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D197
2017-07-30 08:42:40 -07:00
Kostia Balytskyi
99b1950cd9 sparse: make path absoluteness checks cross-platform
Summary: Let's be friendlier to our friends on Windows.

Test Plan: rt

Reviewers: mjpieters, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D194
2017-07-28 06:23:52 -07:00
Stanislau Hlebik
4e6c705cbd fastlog: cleaning up and remove dead code
Test Plan: Run unittests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D187
2017-07-28 02:33:00 -07:00
Jun Wu
fd71c30d42 inhibit: fix date handling and add more tests
Previously, inhibit may use a wrong date when writing markers. This patch
fixes that. Also add a test to check the date and make sure `revive` takes
effects inside a transaction.

Differential Revision: https://phab.mercurial-scm.org/D182
2017-07-27 12:33:43 -07:00
Jun Wu
c68b5e5cdb pushrebase: move bookmarks as well
Differential Revision: https://phab.mercurial-scm.org/D181
2017-07-27 12:33:43 -07:00
Mateusz Kwapich
89aa9cf5dd fbamend: add unhide command for easy unhiding of commits
Summary:
This command helps the user to bring back the commits to life with an explicit
command - wihtout the need to change working copy parent or create bookmarks.

Test Plan: see test

Reviewers: #fbhgext, durham, kulshrax, quark

Reviewed By: #fbhgext, quark

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D179
2017-07-27 03:39:01 -07:00
Mateusz Kwapich
ad3ecb91d5 fbamend: add hide - a simple command for hiding commits
Summary:
We have two commands for hiding commits:
 * strip - which has a lot of legacy options and legacy name
 * prune - which allows for creating arbitrary obsolescence markers

Both of them have complicated UI and are suboptimal experiences for unadvanced
user. The `hg hide` command is very simple, does one job and does it well.

Test Plan: see test

Reviewers: #fbhgext, durham, quark, kulshrax

Reviewed By: #fbhgext, quark

Subscribers: akushner

Differential Revision: https://phab.mercurial-scm.org/D178
2017-07-27 03:39:01 -07:00
David Soria Parra
f9f5201867 p4fastimport: ignore keyword expansion when using cvs tools
Summary:
When we are falling back to cvs tools to read content of a file, we still do
keywrod expansion through cvs `co` command. This patch disables the keyword
expansion.

Test Plan: run tests on test-p4*

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: medson, mjpieters

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

Signature: t1:5485123:1500948788:fe4bc2fb8c50858ba7d8689bbf41d1de41b81000
2017-07-26 14:21:15 -07:00
David Soria Parra
6c6df646bf p4fastimport: use new bookmarks.applychanges API
Summary: Use new bookmarks.applychanges API to silence devel warnings.

Test Plan: python ../../tests/test-p4*

Reviewers: #idi, #mercurial, quark

Reviewed By: quark

Subscribers: medson, mjpieters

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

Tasks: 20395842

Signature: t1:5485091:1500948768:ab8c0a61e57791d4c871daa221f2ad78381fbe81
2017-07-26 14:21:15 -07:00
Simon Farnsworth
bb9d88ea1a githelp: don't crash when user does githelp -- git
Summary:
We didn't check for sanity when the user asked for hg githelp -- git -
oops. Fix the args test to catch you if you ask for help for git, as opposed to
(say) git commit.

Test Plan: Ran the new test cases.

Reviewers: #fbhgext, ikostia

Reviewed By: ikostia

Differential Revision: https://phab.mercurial-scm.org/D183
2017-07-26 08:51:21 -07:00
Mihails Smolins
d5c1c31862 tweakdefaults: show warnings when ':' is used to specify revs
Summary:
Wrapped _analyze parser to display developer warnings whenever ':' is used
implicitly or explicitly.

Test Plan: Added test cases

Reviewers: simonfar, durham, stash

Reviewed By: stash

Subscribers: medson, mjpieters, #mercurial

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

Tasks: 12333181

Signature: t1:5479645:1501056920:304cbda9c0d7fe25dd600ec40c5d7540146c7889
2017-07-26 01:58:18 -07:00
Kostia Balytskyi
475c6c93fd sparse: add a config option to decide if paths are reporoot-relative
Summary:
Adding a knob to control how we perceive supplied paths is a good intermediated
step towards getting every user to use cwd-relative paths.

Test Plan: - rt

Reviewers: mjpieters, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D175
2017-07-25 10:43:55 -07:00
Jeroen Vaelen
5a8a556073 tweakdefaults: output new hashes when nodes get updated
Summary:
Users and particularly automation can benefit from having the new
revision hashes as part of the output of rebase and other operations that
update nodes. Right now, hacks such as getting the tip revision are used to get
that information.

Test Plan: unit tests

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce, durham, stash, quark

Differential Revision: https://phab.mercurial-scm.org/D173
2017-07-25 04:50:28 -07:00
Jeroen Vaelen
f786cd6bdb pushrebase: fix typo
Test Plan: unit tests

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D177
2017-07-24 11:42:24 -07:00
Lukas Piatkowski
8d71aaf0cf histedit: add --retry and --show-plan options
Summary:
--retry can be used instead of --continue when histedit failed on "exec" (due to it returning a non-zero exit code) and the user wants to repeate that command rather than continuing past it
--show-plan will print the remaining plan of histedit during an interrupted histedit

Test Plan: cd fb-hgext/tests/ && rt

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Subscribers: stash, quark

Differential Revision: https://phab.mercurial-scm.org/D176
2017-07-24 09:32:47 -07:00
Ryan McElroy
eebb039cd7 tweakdefaults: remove --nocheck flag
Summary:
Core mercurial has a much better "nocheck" option now that we should just start
using. It's better and it's built-in!

Test Plan: Updated tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D164
2017-07-24 05:37:45 -07:00
Kostia Balytskyi
6b62dd3f52 sparse: properly error out when absolute paths are used
Summary: Current behavior does not even do what it says, let alone the right thing.

Test Plan: - rt

Reviewers: #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D174
2017-07-24 02:12:37 -07:00
Jun Wu
2bb9371eef hiddenoverride: optionally log details
This allows us to log what nodes are pinned by what commands. So we can
manually investigate what was happening when we get user complaints.

Differential Revision: https://phab.mercurial-scm.org/D158
2017-07-21 10:50:30 -07:00
Jun Wu
35b19c0b64 uncommit: allow power users to leave an empty commit around
Some power user workflow requires `uncommit` to leave an empty commit so
they can run `hg amend` afterwards. I don't find easy alternatives so let's
allow that if `ui.allowemptyconfig` is set.

Note: `ui.allowemptyconfig` is an internal config that is not documented for
end-users. Core Mercurial seems to be trying to prevent the empty commit
case from normal users (like, comment disallows that, rebase will skip a
commit if after rebasing it becomes empty). So it seems better to still use
that undocumented config instead of a more discoverable flag.

Differential Revision: https://phab.mercurial-scm.org/D156
2017-07-21 08:06:47 -07:00
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
Stanislau Hlebik
76ac8d65ff smartlog: nit fixes
Test Plan: Slowly run tests

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D167
2017-07-21 07:09:19 -07:00
Mark Thomas
03968e0663 uncommit: keep parent phase for full uncommit
Summary:
When fully uncommitting a commit on top of a public commit, uncommit
erroneously marks the new current commit with the same phase as the old
commit.  It should only do that in the case of a partial commit,
where the new current commit is a new commit.

Test Plan: Add tests to test-uncommit.t.

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D165
2017-07-21 13:27:57 +01:00
Simon Whitaker
d6b24eb1fe githelp: improve output of hg githelp -- git blame
Summary:
Adds user (-u), date (-d) and line number (-l)

If you use Phabricator, also adds Phabricator diff ID (-p)

Test Plan: run-tests.py -l test-githelp.t

Reviewers: #sourcecontrol, mitrandir

Reviewed By: mitrandir

Subscribers: medson, mjpieters

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

Tasks: 11078001

Signature: t1:5469590:1500633342:7be15f60e371dab7016ec44866ea369c696cb0a8
2017-07-21 12:08:18 +01:00
Jun Wu
dc9bcdf448 hiddenoverride: be more conservative about pinning nodes
I think the code works well but it might leave unnecessary pinned nodes
around. This patch makes it more conservative so that only a movement
(update or bookmark) on an obsolete commit would write new pinned nodes.

Differential Revision: https://phab.mercurial-scm.org/D157
2017-07-20 22:22:38 -07:00
Jun Wu
ee3c7459d5 logginghelper: resolve devel-warn 2017-07-20 22:09:22 -07:00
Adam Simpkins
39b79308d5 upgradegeneraldelta: update to work with upstream revlog changes
Summary:
Upstream mercurial commit c20590e65d36 changed revlog.versionformat from a
string to a struct.Struct object.  The upgradegeneraldelta extension needs to
be updated to deal with this.

Test Plan:
Confirmed existing tests pass, and manually tested using pull with
upgradegeneraldelta enabled.  I believe this extension shouldn't really be in
use in any repositories any more, but somehow some users did run into this.

Reviewers: #fbhgext, sid0

Reviewed By: #fbhgext, sid0

Differential Revision: https://phab.mercurial-scm.org/D162
2017-07-20 19:48:21 -07:00
Jun Wu
a63a59059c split: check unfinished first
Differential Revision: https://phab.mercurial-scm.org/D161
2017-07-20 18:21:58 -07:00
Stanislau Hlebik
214387fb21 infinitepush: re-enable lfs support
Summary:
D17 was reverted because it broke creating bundle for non-general delta repos.
The reason is the following: D17 made infinitepush extension override
changegroup.supportedoutgoingversion() function and discard '01' version.
For non-general delta repositories it resulted in broken `hg bundle ...`
command.
`abort: repository does not support bundle version 01`

This diff fixes it by not overriding supportedoutgoingversion(). Instead
getscratchbranchpart() has its own logic of selecting changegroup version.

Test Plan:
Run unit-test
Run `hg bundle -r . --base .^ somefile` in non-general delta repo,
make sure it works fine.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D81
2017-07-20 01:14:35 -07:00
Felix Merk
782636d475 undo: file corruption handling
Basic file corruption handling: if file is corrupted, we nuke our history.
Downside is that we won't be able to undo furter back in case of a corruption,
but considering corruption this is expected.

Differential Revision: https://phab.mercurial-scm.org/D111
2017-07-19 17:49:21 -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
Felix Merk
0077b01e13 undo: add --keep to maintian working copy changes
Allow user to keep working copy changes after undo, mimicking unamend and
uncommit behavior.  As discussed at the team lunch, this allows undo to remain
ignorant of what command the user has run while conforming to user expectations.
In the future this could be done in a smarter way where we properly restore hg
status dynamically.

Differential Revision: https://phab.mercurial-scm.org/D55
2017-07-19 17:49:21 -07:00
Felix Merk
b86893cb84 undo: adds -f flag and gap edge case handling
Prevents users from accidentally crossing gaps in their history and adds an
overwride.  In most cases undoing across a gap isn't desired as the connection
between the pre and post states is unkown.  While undoing across a gap is not
destructive or inherently risky, it is inherently confusing to the user since
we don't know how many and what commands where run.  Furthermore, there is no
guarantee that the pre and post states of a gap are actually connected in any
sane way.

Differential Revision: https://phab.mercurial-scm.org/D53
2017-07-19 17:49:21 -07:00
Felix Merk
1fd69b2cab undo: implements relative undo, hg redo and tests
Implements, and makes default relative undos and adds redos.  A relative undo
behaves differently only if you haven't performend any repo changing operations
since your previous undo or redo, in which case you operate relative to that
undo/redo.  This means that a second undo will not undo the previous undo but
instead bring you furter back.

Differential Revision: https://phab.mercurial-scm.org/D52
2017-07-19 17:49:21 -07:00
Felix Merk
683f74bc3b undo: bare bones undo without tests
Adds undo command that changes working copy parent, bookmarks and
visible draft commits to a previous repo state.

Differential Revision: https://phab.mercurial-scm.org/D51
2017-07-19 17:49:21 -07:00
Felix Merk
c18c86359b hiddenoverride: in memory/disc out of sync fix
Before, out of syncness of in memory state and on disc state caused certain
commands to (appear to) perform repo changes after they had returned.  This
broke hg undo.  This change fixes this by using the in memory state.

Differential Revision: https://phab.mercurial-scm.org/D150
2017-07-19 17:49:21 -07:00
Adam Simpkins
6a5431e1a3 phabstatus: query conduit more efficiently for "hg log"
Summary:
Update the phabstatus code to peek ahead at revisions to be logged by
`hg log` and `hg log --graph` and query phabricator for multiple revisions at
once, rather than having to query them one at a time.

Previously it had special integration with the smartlog where it could do this
for smartlog, but not for the normal "hg log" command.

Wrapping the revset iterator this way feels somewhat hacky, but this seems like
the best way to achieve the desired results without upstream changes.  (In an
ideal world we would perhaps update the log code to process things in an
asynchronous fashion, to better support templates that may take a non-trivial
amount time to render.  Ideally the revset query would be processed in parallel
with template rendering.)

Test Plan:
Confirmed existing tests still pass, and manually tested various combinations
of `hg log`, `hg log --graph` and `hg smartlog`

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D80
2017-07-19 12:34:46 -07:00
Adam Simpkins
98d62c4a8a phabstatus: clean up showsyncstatus()
Summary:
Refactor the showsyncstatus function to clean up the code a little bit.

- Don't bother to call populateresponseforphab() if the current commit does not
  contain a differential revision ID.
- Only call getdiffstatus() once instead of 4 times.  getdiffstatus() does
  cache the result instead of hitting phabricator each time, but it is still
  better to just re-use the return value ourselves instead of hitting the
  memoization code.
- Refactor the error handling to avoid having deeply nested conditional blocks.

Test Plan: Confirmed existing tests still pass, and manually tested using the template.

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D79
2017-07-19 12:34:46 -07:00
Jun Wu
6ed0a1e206 smartlog: only count visible successors
Invisible successors could be confusing. Therefore only show visible
successors.

Differential Revision: https://phab.mercurial-scm.org/D149
2017-07-19 10:43:01 -07:00
Fano Yong
050a2705e7 pushrebase.py modification to skip cache when _data is not found
Summary: pushrebase.py modification to skip cache when _data is not found

Test Plan: hg-dev rt pushrebase*

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mitrandir, medson, mjpieters, #mercurial

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

Tasks: 19603920

Tags: hg

Signature: t1:5367059:1500457213:d9870e1af74a4e27c1be2b08f440dc5e3f905947

Blame Revision: n/a
2017-07-19 09:09:04 -07:00
Ryan McElroy
f95c4e8f49 drop: fix check-code failures
Summary: These issues broke test-check-code-hg.t

Test Plan: test-check-code-hg.t now passes

Reviewers: #fbhgext, stash, simonfar

Reviewed By: #fbhgext, stash, simonfar

Differential Revision: https://phab.mercurial-scm.org/D145
2017-07-19 07:08:21 -07:00
Ola Kopczynska-Dobosz
379f8596da Adding drop command
Summary: Adding a drop extension which drops specified commit from the stack.

Test Plan: Unit tests which are part of this diff and manual testing.

Reviewers: durham, gshanbhag, #mercurial, kulshrax

Reviewed By: kulshrax

Subscribers: mitrandir, quark, #mercurial, phillco, avig, medson, mjpieters

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

Tasks: 19602078

Signature: t1:5346014:1500438430:b38acce97940fdeb7103ae70844cce71fdd79698
2017-07-18 21:57:03 -07:00
Arun Kulshreshtha
79baca1fcf fbamend: add --clean flag to hg prev/next
Summary: This patch adds a `--clean` flag to `hg prev` and `next` that discards any pending changes, similar to `hg update --clean`.

Test Plan: See included test changes.

Reviewers: #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D140
2017-07-18 20:13:25 -07:00
Jun Wu
0e6e370774 hiddenoverride: avoid race condition updating the state file
Previously there is a race condition:

    origpinned = loadpinnednodes(repo)
    newpinned = ....
    with repo.lock(): # the lock might be taken by process X
        # get the lock after some time. at this time, the state file might
        # be updated by process X but we are not aware of it.
        savepinnednodes(...) # process X's change gets discarded

This patch solves that by making the write function takes a delta instead of
full content, and apply that delta inside a lock. Using repo lock is
expensive so we use a single-file lightweight flock instead.

Differential Revision: https://phab.mercurial-scm.org/D139
2017-07-18 16:07:33 -07:00
Jun Wu
2211d677b5 pushrebase: move working copy parent
When pushing the current changeset like `hg push -r . --to x`, try to update
the working copy parent.

Differential Revision: https://phab.mercurial-scm.org/D123
2017-07-18 12:16:04 -07:00