2017-04-06 23:36:18 +03:00
|
|
|
# fbshow.py
|
Make 'hg show' a native command
Summary:
There are a few ways in which the 'hg show' alias doesn't work for users:
1) if your argument to 'hg show' isn't in exactly the right form, you get confusing messages (e.g. if you run 'hg show --help').
2) It's slow compared to 'git show', and needs speeding up. There's some low-hanging fruit identified by bryano, and having the command as a native command makes it easier to go there.
As a first step towards fixing this, reimplement the existing alias as a Python extension, aiming for minimum behaviour changes. We can inline the implementation of 'hg log' when we need to.
Test Plan:
Run the new automatic test test-show.t:
: /data/users/simonfar/fb-hgext (hg) [nativeshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
Note that this means that review needs to cover the automatic test, too, in case I've missed anything important
Reviewers: #sourcecontrol, lcharignon, ttung, rmcelroy
Reviewed By: lcharignon, rmcelroy
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2820421
Tasks: 9323445, 9599994
Signature: t1:2820421:1452541611:02efa59739f690b30053d93e0d47adf0aef8dbf4
2016-01-12 22:20:28 +03:00
|
|
|
#
|
|
|
|
# Copyright 2016 Facebook, Inc.
|
|
|
|
#
|
|
|
|
# This software may be used and distributed according to the terms of the
|
|
|
|
# GNU General Public License version 2 or any later version.
|
2017-03-25 01:22:31 +03:00
|
|
|
"""show changesets in detail with full log message, patches etc
|
Make 'hg show' a native command
Summary:
There are a few ways in which the 'hg show' alias doesn't work for users:
1) if your argument to 'hg show' isn't in exactly the right form, you get confusing messages (e.g. if you run 'hg show --help').
2) It's slow compared to 'git show', and needs speeding up. There's some low-hanging fruit identified by bryano, and having the command as a native command makes it easier to go there.
As a first step towards fixing this, reimplement the existing alias as a Python extension, aiming for minimum behaviour changes. We can inline the implementation of 'hg log' when we need to.
Test Plan:
Run the new automatic test test-show.t:
: /data/users/simonfar/fb-hgext (hg) [nativeshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
Note that this means that review needs to cover the automatic test, too, in case I've missed anything important
Reviewers: #sourcecontrol, lcharignon, ttung, rmcelroy
Reviewed By: lcharignon, rmcelroy
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2820421
Tasks: 9323445, 9599994
Signature: t1:2820421:1452541611:02efa59739f690b30053d93e0d47adf0aef8dbf4
2016-01-12 22:20:28 +03:00
|
|
|
|
|
|
|
For example, 'hg show --stat' prints something like:
|
|
|
|
|
|
|
|
$ hg show --stat
|
|
|
|
changeset: 1:b73358b94785
|
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
files: x
|
|
|
|
description:
|
|
|
|
longer
|
|
|
|
|
|
|
|
|
|
|
|
x | 1 +
|
|
|
|
1 files changed, 1 insertions(+), 0 deletions(-)
|
|
|
|
|
|
|
|
diff -r 852a8d467a01 -r b73358b94785 x
|
|
|
|
--- a/x Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/x Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
@@ -1,1 +1,2 @@
|
|
|
|
show
|
|
|
|
+more
|
|
|
|
"""
|
|
|
|
|
|
|
|
from mercurial.i18n import _
|
2017-05-22 23:38:37 +03:00
|
|
|
from mercurial import cmdutil, commands, error, registrar, scmutil
|
Make 'hg show' a native command
Summary:
There are a few ways in which the 'hg show' alias doesn't work for users:
1) if your argument to 'hg show' isn't in exactly the right form, you get confusing messages (e.g. if you run 'hg show --help').
2) It's slow compared to 'git show', and needs speeding up. There's some low-hanging fruit identified by bryano, and having the command as a native command makes it easier to go there.
As a first step towards fixing this, reimplement the existing alias as a Python extension, aiming for minimum behaviour changes. We can inline the implementation of 'hg log' when we need to.
Test Plan:
Run the new automatic test test-show.t:
: /data/users/simonfar/fb-hgext (hg) [nativeshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
Note that this means that review needs to cover the automatic test, too, in case I've missed anything important
Reviewers: #sourcecontrol, lcharignon, ttung, rmcelroy
Reviewed By: lcharignon, rmcelroy
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2820421
Tasks: 9323445, 9599994
Signature: t1:2820421:1452541611:02efa59739f690b30053d93e0d47adf0aef8dbf4
2016-01-12 22:20:28 +03:00
|
|
|
|
|
|
|
cmdtable = {}
|
2017-05-22 23:38:37 +03:00
|
|
|
command = registrar.command(cmdtable)
|
2016-11-29 16:24:07 +03:00
|
|
|
testedwith = 'ships-with-fb-hgext'
|
Make 'hg show' a native command
Summary:
There are a few ways in which the 'hg show' alias doesn't work for users:
1) if your argument to 'hg show' isn't in exactly the right form, you get confusing messages (e.g. if you run 'hg show --help').
2) It's slow compared to 'git show', and needs speeding up. There's some low-hanging fruit identified by bryano, and having the command as a native command makes it easier to go there.
As a first step towards fixing this, reimplement the existing alias as a Python extension, aiming for minimum behaviour changes. We can inline the implementation of 'hg log' when we need to.
Test Plan:
Run the new automatic test test-show.t:
: /data/users/simonfar/fb-hgext (hg) [nativeshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
Note that this means that review needs to cover the automatic test, too, in case I've missed anything important
Reviewers: #sourcecontrol, lcharignon, ttung, rmcelroy
Reviewed By: lcharignon, rmcelroy
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2820421
Tasks: 9323445, 9599994
Signature: t1:2820421:1452541611:02efa59739f690b30053d93e0d47adf0aef8dbf4
2016-01-12 22:20:28 +03:00
|
|
|
|
|
|
|
def uisetup(ui):
|
|
|
|
permitted_opts = [
|
|
|
|
('g', 'git', None, _('use git extended diff format')),
|
|
|
|
('', 'stat', None, _('output diffstat-style summary of changes')),
|
|
|
|
] + commands.templateopts + commands.walkopts
|
|
|
|
|
2017-05-15 15:59:55 +03:00
|
|
|
local_opts = [
|
|
|
|
('U', 'unified', int, _('number of lines of diff context to show')),
|
|
|
|
]
|
|
|
|
|
Make 'hg show' a native command
Summary:
There are a few ways in which the 'hg show' alias doesn't work for users:
1) if your argument to 'hg show' isn't in exactly the right form, you get confusing messages (e.g. if you run 'hg show --help').
2) It's slow compared to 'git show', and needs speeding up. There's some low-hanging fruit identified by bryano, and having the command as a native command makes it easier to go there.
As a first step towards fixing this, reimplement the existing alias as a Python extension, aiming for minimum behaviour changes. We can inline the implementation of 'hg log' when we need to.
Test Plan:
Run the new automatic test test-show.t:
: /data/users/simonfar/fb-hgext (hg) [nativeshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
Note that this means that review needs to cover the automatic test, too, in case I've missed anything important
Reviewers: #sourcecontrol, lcharignon, ttung, rmcelroy
Reviewed By: lcharignon, rmcelroy
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2820421
Tasks: 9323445, 9599994
Signature: t1:2820421:1452541611:02efa59739f690b30053d93e0d47adf0aef8dbf4
2016-01-12 22:20:28 +03:00
|
|
|
aliases, entry = cmdutil.findcmd('log', commands.table)
|
2017-05-15 15:59:55 +03:00
|
|
|
allowed_opts = [opt for opt in entry[1]
|
|
|
|
if opt in permitted_opts] + local_opts
|
Make 'hg show' a native command
Summary:
There are a few ways in which the 'hg show' alias doesn't work for users:
1) if your argument to 'hg show' isn't in exactly the right form, you get confusing messages (e.g. if you run 'hg show --help').
2) It's slow compared to 'git show', and needs speeding up. There's some low-hanging fruit identified by bryano, and having the command as a native command makes it easier to go there.
As a first step towards fixing this, reimplement the existing alias as a Python extension, aiming for minimum behaviour changes. We can inline the implementation of 'hg log' when we need to.
Test Plan:
Run the new automatic test test-show.t:
: /data/users/simonfar/fb-hgext (hg) [nativeshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
Note that this means that review needs to cover the automatic test, too, in case I've missed anything important
Reviewers: #sourcecontrol, lcharignon, ttung, rmcelroy
Reviewed By: lcharignon, rmcelroy
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2820421
Tasks: 9323445, 9599994
Signature: t1:2820421:1452541611:02efa59739f690b30053d93e0d47adf0aef8dbf4
2016-01-12 22:20:28 +03:00
|
|
|
|
|
|
|
# manual call of the decorator
|
|
|
|
command('^show',
|
|
|
|
allowed_opts,
|
2016-02-12 14:07:11 +03:00
|
|
|
_('[OPTION]... [REV [FILE]...]'),
|
Make 'hg show' a native command
Summary:
There are a few ways in which the 'hg show' alias doesn't work for users:
1) if your argument to 'hg show' isn't in exactly the right form, you get confusing messages (e.g. if you run 'hg show --help').
2) It's slow compared to 'git show', and needs speeding up. There's some low-hanging fruit identified by bryano, and having the command as a native command makes it easier to go there.
As a first step towards fixing this, reimplement the existing alias as a Python extension, aiming for minimum behaviour changes. We can inline the implementation of 'hg log' when we need to.
Test Plan:
Run the new automatic test test-show.t:
: /data/users/simonfar/fb-hgext (hg) [nativeshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
Note that this means that review needs to cover the automatic test, too, in case I've missed anything important
Reviewers: #sourcecontrol, lcharignon, ttung, rmcelroy
Reviewed By: lcharignon, rmcelroy
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2820421
Tasks: 9323445, 9599994
Signature: t1:2820421:1452541611:02efa59739f690b30053d93e0d47adf0aef8dbf4
2016-01-12 22:20:28 +03:00
|
|
|
inferrepo=True)(show)
|
|
|
|
|
|
|
|
def show(ui, repo, *args, **opts):
|
2016-07-01 19:33:06 +03:00
|
|
|
"""show revision in detail
|
Make 'hg show' a native command
Summary:
There are a few ways in which the 'hg show' alias doesn't work for users:
1) if your argument to 'hg show' isn't in exactly the right form, you get confusing messages (e.g. if you run 'hg show --help').
2) It's slow compared to 'git show', and needs speeding up. There's some low-hanging fruit identified by bryano, and having the command as a native command makes it easier to go there.
As a first step towards fixing this, reimplement the existing alias as a Python extension, aiming for minimum behaviour changes. We can inline the implementation of 'hg log' when we need to.
Test Plan:
Run the new automatic test test-show.t:
: /data/users/simonfar/fb-hgext (hg) [nativeshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
Note that this means that review needs to cover the automatic test, too, in case I've missed anything important
Reviewers: #sourcecontrol, lcharignon, ttung, rmcelroy
Reviewed By: lcharignon, rmcelroy
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2820421
Tasks: 9323445, 9599994
Signature: t1:2820421:1452541611:02efa59739f690b30053d93e0d47adf0aef8dbf4
2016-01-12 22:20:28 +03:00
|
|
|
|
2016-02-12 14:07:11 +03:00
|
|
|
This behaves similarly to :hg:`log -vp -r REV [OPTION]... [FILE]...`, or
|
|
|
|
if called without a REV, :hg:`log -vp -r . [OPTION]...` Use
|
2016-04-04 22:48:01 +03:00
|
|
|
:hg:`log` for more powerful operations than supported by hg show
|
Make 'hg show' a native command
Summary:
There are a few ways in which the 'hg show' alias doesn't work for users:
1) if your argument to 'hg show' isn't in exactly the right form, you get confusing messages (e.g. if you run 'hg show --help').
2) It's slow compared to 'git show', and needs speeding up. There's some low-hanging fruit identified by bryano, and having the command as a native command makes it easier to go there.
As a first step towards fixing this, reimplement the existing alias as a Python extension, aiming for minimum behaviour changes. We can inline the implementation of 'hg log' when we need to.
Test Plan:
Run the new automatic test test-show.t:
: /data/users/simonfar/fb-hgext (hg) [nativeshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
Note that this means that review needs to cover the automatic test, too, in case I've missed anything important
Reviewers: #sourcecontrol, lcharignon, ttung, rmcelroy
Reviewed By: lcharignon, rmcelroy
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2820421
Tasks: 9323445, 9599994
Signature: t1:2820421:1452541611:02efa59739f690b30053d93e0d47adf0aef8dbf4
2016-01-12 22:20:28 +03:00
|
|
|
|
|
|
|
See :hg:`help templates` for more about pre-packaged styles and
|
|
|
|
specifying custom templates.
|
2016-02-12 14:07:11 +03:00
|
|
|
|
Make 'hg show' a native command
Summary:
There are a few ways in which the 'hg show' alias doesn't work for users:
1) if your argument to 'hg show' isn't in exactly the right form, you get confusing messages (e.g. if you run 'hg show --help').
2) It's slow compared to 'git show', and needs speeding up. There's some low-hanging fruit identified by bryano, and having the command as a native command makes it easier to go there.
As a first step towards fixing this, reimplement the existing alias as a Python extension, aiming for minimum behaviour changes. We can inline the implementation of 'hg log' when we need to.
Test Plan:
Run the new automatic test test-show.t:
: /data/users/simonfar/fb-hgext (hg) [nativeshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
Note that this means that review needs to cover the automatic test, too, in case I've missed anything important
Reviewers: #sourcecontrol, lcharignon, ttung, rmcelroy
Reviewed By: lcharignon, rmcelroy
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2820421
Tasks: 9323445, 9599994
Signature: t1:2820421:1452541611:02efa59739f690b30053d93e0d47adf0aef8dbf4
2016-01-12 22:20:28 +03:00
|
|
|
"""
|
|
|
|
if len(args) == 0:
|
|
|
|
opts['rev'] = ['.']
|
2016-02-12 14:07:11 +03:00
|
|
|
pats = []
|
Make 'hg show' a native command
Summary:
There are a few ways in which the 'hg show' alias doesn't work for users:
1) if your argument to 'hg show' isn't in exactly the right form, you get confusing messages (e.g. if you run 'hg show --help').
2) It's slow compared to 'git show', and needs speeding up. There's some low-hanging fruit identified by bryano, and having the command as a native command makes it easier to go there.
As a first step towards fixing this, reimplement the existing alias as a Python extension, aiming for minimum behaviour changes. We can inline the implementation of 'hg log' when we need to.
Test Plan:
Run the new automatic test test-show.t:
: /data/users/simonfar/fb-hgext (hg) [nativeshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
Note that this means that review needs to cover the automatic test, too, in case I've missed anything important
Reviewers: #sourcecontrol, lcharignon, ttung, rmcelroy
Reviewed By: lcharignon, rmcelroy
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2820421
Tasks: 9323445, 9599994
Signature: t1:2820421:1452541611:02efa59739f690b30053d93e0d47adf0aef8dbf4
2016-01-12 22:20:28 +03:00
|
|
|
else:
|
2016-02-12 14:07:11 +03:00
|
|
|
opts['rev'] = [args[0]]
|
|
|
|
pats = args[1:]
|
|
|
|
if not scmutil.revrange(repo, opts['rev']):
|
|
|
|
h = _("if %s is a file, try `hg show . %s`") % (args[0], args[0])
|
|
|
|
raise error.Abort(_("unknown revision %s") % args[0],
|
|
|
|
hint=h)
|
Make 'hg show' a native command
Summary:
There are a few ways in which the 'hg show' alias doesn't work for users:
1) if your argument to 'hg show' isn't in exactly the right form, you get confusing messages (e.g. if you run 'hg show --help').
2) It's slow compared to 'git show', and needs speeding up. There's some low-hanging fruit identified by bryano, and having the command as a native command makes it easier to go there.
As a first step towards fixing this, reimplement the existing alias as a Python extension, aiming for minimum behaviour changes. We can inline the implementation of 'hg log' when we need to.
Test Plan:
Run the new automatic test test-show.t:
: /data/users/simonfar/fb-hgext (hg) [nativeshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
Note that this means that review needs to cover the automatic test, too, in case I've missed anything important
Reviewers: #sourcecontrol, lcharignon, ttung, rmcelroy
Reviewed By: lcharignon, rmcelroy
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2820421
Tasks: 9323445, 9599994
Signature: t1:2820421:1452541611:02efa59739f690b30053d93e0d47adf0aef8dbf4
2016-01-12 22:20:28 +03:00
|
|
|
|
|
|
|
opts['patch'] = True
|
|
|
|
opts['verbose'] = True
|
|
|
|
|
Turn off git diff by default in 'hg show'
Summary:
Bryan O'Sullivan found that the copy detection in git diff was a significant contributor to the relative slowness of 'hg log -vpr .' compared to 'git show'. Automatically disable git-style diff by default for 'hg show', and allow you to re-enable it via command line option if you need it and can accept the slowdown.
Depends on D2820421
Test Plan:
Run the automated test and confirm no regression.
```
: /data/users/simonfar/fb-hgext (hg) [nocopydetectioninshow]
: simonfar@devvm148 tests $ ../../hg/tests/run-tests.py -l test-show.t -i
.
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
```
Confirm that git diffs are the default in your hgrc:
```
: /data/users/simonfar/fb-hgext (hg) [nocopydetectioninshow]
: simonfar@devvm148 tests $ hg --config alias.show=show --config extensions.show=../show.py showconfig | grep diff.git
diff.git=True
```
Run the new 'hg show' manually, and confirm that you don't get a git diff despite your hgrc setting:
```
: /data/users/simonfar/fb-hgext (hg) [nocopydetectioninshow]
: simonfar@devvm148 tests $ hg --config alias.show=show --config extensions.show=../show.py show
changeset: 7d57a1e75587af73e252d69611aa12ebffc38e78 (@)
bookmarks: nocopydetectioninshow
user: Simon Farnsworth <simonfar@fb.com>
date: Mon, 11 Jan 2016 16:28:15 -0800
Turn off git diff by default in
'hg show'
diff -r 6dda76b19bf1 -r 7d57a1e75587 show.py
--- a/show.py Mon Jan 11 15:30:19 2016 -0800
+++ b/show.py Mon Jan 11 16:28:15 2016 -0800
@@ -93,16 +93,27 @@
opts['patch'] = True
opts['verbose'] = True
- backup = ui.backupconfig('ui', 'verbose')
- basebackup = repo.baseui.backupconfig('ui', 'verbose')
+
+ verbosebackup = ui.backupconfig('ui', 'verbose')
+ verbosebasebackup = repo.baseui.backupconfig('ui', 'verbose')
+ # Copy tracking is slow when doing a git diff. Override hgrc, and rely on
+ # opts getting us a git diff if it's been requested. Ideally, we'd find and
+ # fix the slowness in copy tracking, but this works for now.
+ # See Bryan O'Sullivan's comments on task 9599994 for context
+ gitdiffbackup = ui.backupconfig('diff', 'git')
+ gitdiffbasebackup = ui.backupconfig('diff', 'git')
try:
ui.setconfig('ui', 'verbose', True)
+ ui.setconfig('diff', 'git', False)
# Propagate to subrepos
repo.baseui.setconfig('ui', 'verbose', True)
+ repo.baseui.setconfig('diff', 'git', False)
newargs = []
commands.log(ui, repo, *newargs, **opts)
finally:
- ui.restoreconfig(backup)
- repo.baseui.restoreconfig(basebackup)
+ ui.restoreconfig(gitdiffbackup)
+ repo.baseui.restoreconfig(gitdiffbasebackup)
+ ui.restoreconfig(verbosebackup)
+ repo.baseui.restoreconfig(verbosebasebackup)
```
Run the new 'hg show' manually with --git, and confirm that you get a git diff:
```
: /data/users/simonfar/fb-hgext (hg) [nocopydetectioninshow]
: simonfar@devvm148 tests $ hg --config alias.show=show --config extensions.show=../show.py show --git
changeset: 7d57a1e75587af73e252d69611aa12ebffc38e78 (@)
bookmarks: nocopydetectioninshow
user: Simon Farnsworth <simonfar@fb.com>
date: Mon, 11 Jan 2016 16:28:15 -0800
Turn off git diff by default in 'hg show'
diff --git a/show.py b/show.py
--- a/show.py
+++ b/show.py
@@ -93,16 +93,27 @@
opts['patch'] = True
opts['verbose'] = True
- backup = ui.backupconfig('ui', 'verbose')
- basebackup = repo.baseui.backupconfig('ui', 'verbose')
+
+ verbosebackup = ui.backupconfig('ui', 'verbose')
+ verbosebasebackup = repo.baseui.backupconfig('ui', 'verbose')
+ # Copy tracking is slow when doing a git diff. Override hgrc, and rely on
+ # opts getting us a git diff if it's been requested. Ideally, we'd find and
+ # fix the slowness in copy tracking, but this works for now.
+ # See Bryan O'Sullivan's comments on task 9599994 for context
+ gitdiffbackup = ui.backupconfig('diff', 'git')
+ gitdiffbasebackup = ui.backupconfig('diff', 'git')
try:
ui.setconfig('ui', 'verbose', True)
+ ui.setconfig('diff', 'git', False)
# Propagate to subrepos
repo.baseui.setconfig('ui', 'verbose', True)
+ repo.baseui.setconfig('diff', 'git', False)
newargs = []
commands.log(ui, repo, *newargs, **opts)
finally:
- ui.restoreconfig(backup)
- repo.baseui.restoreconfig(basebackup)
+ ui.restoreconfig(gitdiffbackup)
+ repo.baseui.restoreconfig(gitdiffbasebackup)
+ ui.restoreconfig(verbosebackup)
+ repo.baseui.restoreconfig(verbosebasebackup)
```
Reviewers: #sourcecontrol, ttung, lcharignon
Reviewed By: lcharignon
Subscribers: rmcelroy, lcharignon, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2822071
Tasks: 9599994
Signature: t1:2822071:1452586169:59011b5331cd6c76741cae348c8db4912ed6c9b7
2016-01-12 22:24:35 +03:00
|
|
|
# Copy tracking is slow when doing a git diff. Override hgrc, and rely on
|
|
|
|
# opts getting us a git diff if it's been requested. Ideally, we'd find and
|
|
|
|
# fix the slowness in copy tracking, but this works for now.
|
|
|
|
# On a commit with lots of possible copies, Bryan O'Sullivan found that this
|
|
|
|
# reduces "time hg show" from 1.76 seconds to 0.81 seconds.
|
2017-05-15 15:59:55 +03:00
|
|
|
overrides = {('diff', 'git'): opts.get('git')
|
|
|
|
,('diff','unified'):opts.get('unified')
|
|
|
|
,('ui', 'verbose'): True}
|
2017-03-18 05:42:50 +03:00
|
|
|
with ui.configoverride(overrides, 'show'):
|
2016-02-12 14:07:11 +03:00
|
|
|
commands.log(ui, repo, *pats, **opts)
|