mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
fbamend: move evolve warning to be inside the amend command
Summary: With the new evolve+inhibit ecosystem, we want to allow amend and amend --rebase to continue working even when evolve is on. Let's move the evolve check to be inside the amend command, and only complain when we see the evolve commands enabled. Test Plan: Added a test Reviewers: lcharignon, pyd Reviewed By: pyd Differential Revision: https://phabricator.fb.com/D2033649 Signature: t1:2033649:1430346833:3116b704e49f634709a6fea32e217b94e731b96f
This commit is contained in:
parent
62867737b2
commit
6b99e31175
23
fbamend.py
23
fbamend.py
@ -36,18 +36,6 @@ amendopts = [
|
||||
]
|
||||
|
||||
def uisetup(ui):
|
||||
if obsolete._enabled:
|
||||
msg = ('fbamend and evolve extension are imcompatible, '
|
||||
'fbamend deactivated.\n'
|
||||
'You can either disable it globally:\n'
|
||||
'- type `hg config --edit`\n'
|
||||
'- drop the `fbamend=` line from the `[extensions]` section\n'
|
||||
'or disable it for a specific repo:\n'
|
||||
'- type `hg config --local --edit`\n'
|
||||
'- add a `fbamend=!%s` line in the `[extensions]` section\n')
|
||||
msg %= ui.config('extensions', 'fbamend')
|
||||
ui.write_err(msg)
|
||||
return
|
||||
entry = extensions.wrapcommand(commands.table, 'commit', commit)
|
||||
for opt in amendopts:
|
||||
opt = (opt[0], opt[1], opt[2], "(with --amend) " + opt[3])
|
||||
@ -72,6 +60,17 @@ def commit(orig, ui, repo, *pats, **opts):
|
||||
def amend(ui, repo, *pats, **opts):
|
||||
'''amend the current commit with more changes
|
||||
'''
|
||||
if obsolete.isenabled(repo, 'allnewcommands'):
|
||||
msg = ('fbamend and evolve extension are incompatible, '
|
||||
'fbamend deactivated.\n'
|
||||
'You can either disable it globally:\n'
|
||||
'- type `hg config --edit`\n'
|
||||
'- drop the `fbamend=` line from the `[extensions]` section\n'
|
||||
'or disable it for a specific repo:\n'
|
||||
'- type `hg config --local --edit`\n'
|
||||
'- add a `fbamend=!%s` line in the `[extensions]` section\n')
|
||||
msg %= ui.config('extensions', 'fbamend')
|
||||
ui.write_err(msg)
|
||||
rebase = opts.get('rebase')
|
||||
|
||||
if rebase and _histediting(repo):
|
||||
|
@ -266,47 +266,32 @@ Test that --addremove/-A works
|
||||
|
||||
Test that the extension disables itself when evolution is enabled
|
||||
|
||||
$ cat > ${TESTTMP}/obs.py << EOF
|
||||
> import mercurial.obsolete
|
||||
> mercurial.obsolete._enabled = True
|
||||
$ $PYTHON -c 'import evolve' || exit 80
|
||||
$ cat >> .hg/hgrc <<EOF
|
||||
> [extensions]
|
||||
> evolve=
|
||||
> EOF
|
||||
$ echo '[extensions]' >> $HGRCPATH
|
||||
$ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
|
||||
|
||||
noisy warning
|
||||
noisy warning during amend
|
||||
|
||||
$ hg version 2>&1
|
||||
fbamend and evolve extension are imcompatible, fbamend deactivated.
|
||||
$ hg amend 2>&1
|
||||
fbamend and evolve extension are incompatible, fbamend deactivated.
|
||||
You can either disable it globally:
|
||||
- type `hg config --edit`
|
||||
- drop the `fbamend=` line from the `[extensions]` section
|
||||
or disable it for a specific repo:
|
||||
- type `hg config --local --edit`
|
||||
- add a `fbamend=!$TESTTMP/fbamend.py` line in the `[extensions]` section
|
||||
Mercurial Distributed SCM (version *) (glob)
|
||||
(see http://mercurial.selenic.com for more information)
|
||||
|
||||
Copyright (C) 2005-2015 Matt Mackall and others
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
commit has no new flags
|
||||
|
||||
$ hg help commit 2> /dev/null | grep -- --fixup
|
||||
[1]
|
||||
$ hg help commit 2> /dev/null | grep -- --rebase
|
||||
nothing changed
|
||||
[1]
|
||||
|
||||
The amend command is missing
|
||||
no warning if only obsolete markers are enabled
|
||||
|
||||
$ hg help amend
|
||||
fbamend and evolve extension are imcompatible, fbamend deactivated.
|
||||
You can either disable it globally:
|
||||
- type `hg config --edit`
|
||||
- drop the `fbamend=` line from the `[extensions]` section
|
||||
or disable it for a specific repo:
|
||||
- type `hg config --local --edit`
|
||||
- add a `fbamend=!$TESTTMP/fbamend.py` line in the `[extensions]` section
|
||||
abort: no such help topic: amend
|
||||
(try "hg help --keyword amend")
|
||||
[255]
|
||||
$ cat >> .hg/hgrc <<EOF
|
||||
> [experimental]
|
||||
> evolution=createmarkers
|
||||
> EOF
|
||||
|
||||
$ hg amend
|
||||
nothing changed
|
||||
[1]
|
||||
|
Loading…
Reference in New Issue
Block a user