##// END OF EJS Templates
error: introduce StorageError...
error: introduce StorageError Errors in revlogs are often represented by RevlogError. It's fine for revlogs to raise a revlog-specific exception. But in the context of multiple storage backends, it doesn't make sense to be throwing or catching an exception with "revlog" in its name when revlogs may not even be in play. This commit introduces a new generic StorageError type for representing errors in the storage layer. RevlogError is an instance of this type. Interface documentation and tests referencing RevlogError has been updated to specify StorageError should be used. .. api:: ``error.StorageError`` has been introduced to represent errors in storage. It should be used in place of ``error.RevlogError`` unless the error is known to come from a revlog. Differential Revision: https://phab.mercurial-scm.org/D4654

File last commit:

r38806:e7aa113b default
r39812:cb65d4b7 default
Show More
histedit.py
1657 lines | 58.1 KiB | text/x-python | PythonLexer
Augie Fackler
histedit: new extension for interactive history editing
r17064 # histedit.py - interactive history editing for mercurial
#
# Copyright 2009 Augie Fackler <raf@durin42.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
Augie Fackler
histedit: add extension docstring from external README...
r17131 """interactive history editing
With this extension installed, Mercurial gains one new command: histedit. Usage
is as follows, assuming the following history::
@ 3[tip] 7c2fd3b9020c 2009-04-27 18:04 -0500 durin42
| Add delta
|
o 2 030b686bedc4 2009-04-27 18:04 -0500 durin42
| Add gamma
|
o 1 c561b4e977df 2009-04-27 18:04 -0500 durin42
| Add beta
|
o 0 d8d2fcd0e319 2009-04-27 18:04 -0500 durin42
Add alpha
If you were to run ``hg histedit c561b4e977df``, you would see the following
file open in your editor::
pick c561b4e977df Add beta
pick 030b686bedc4 Add gamma
pick 7c2fd3b9020c Add delta
FUJIWARA Katsunori
histedit: correct changeset IDs in online help...
r18322 # Edit history between c561b4e977df and 7c2fd3b9020c
Augie Fackler
histedit: add extension docstring from external README...
r17131 #
Adrian Zgorzałek
histedit: clarify description of fold command...
r20503 # Commits are listed from least to most recent
#
Augie Fackler
histedit: add extension docstring from external README...
r17131 # Commands:
# p, pick = use commit
# e, edit = use commit, but stop for amending
Matt Mackall
histedit: shorten new fold message...
r20511 # f, fold = use commit, but combine it with the one above
Ben Schmidt
histedit: modify rollup to discard date from the rollup commit (issue4820)...
r31056 # r, roll = like fold, but discard this commit's description and date
Augie Fackler
histedit: add extension docstring from external README...
r17131 # d, drop = remove commit from history
timeless@mozdev.org
histedit: improve discoverability of edit commit message
r26100 # m, mess = edit commit message without changing commit content
Saurabh Singh
histedit: removing the experimental config 'histeditng'...
r34490 # b, base = checkout changeset and apply further changesets from there
Augie Fackler
histedit: add extension docstring from external README...
r17131 #
In this file, lines beginning with ``#`` are ignored. You must specify a rule
for each revision in your history. For example, if you had meant to add gamma
before beta, and then wanted to add delta in the same revision as beta, you
would reorganize the file to look like this::
pick 030b686bedc4 Add gamma
pick c561b4e977df Add beta
fold 7c2fd3b9020c Add delta
FUJIWARA Katsunori
histedit: correct changeset IDs in online help...
r18322 # Edit history between c561b4e977df and 7c2fd3b9020c
Augie Fackler
histedit: add extension docstring from external README...
r17131 #
Adrian Zgorzałek
histedit: clarify description of fold command...
r20503 # Commits are listed from least to most recent
#
Augie Fackler
histedit: add extension docstring from external README...
r17131 # Commands:
# p, pick = use commit
# e, edit = use commit, but stop for amending
Matt Mackall
histedit: shorten new fold message...
r20511 # f, fold = use commit, but combine it with the one above
Ben Schmidt
histedit: modify rollup to discard date from the rollup commit (issue4820)...
r31056 # r, roll = like fold, but discard this commit's description and date
Augie Fackler
histedit: add extension docstring from external README...
r17131 # d, drop = remove commit from history
timeless@mozdev.org
histedit: improve discoverability of edit commit message
r26100 # m, mess = edit commit message without changing commit content
Saurabh Singh
histedit: removing the experimental config 'histeditng'...
r34490 # b, base = checkout changeset and apply further changesets from there
Augie Fackler
histedit: add extension docstring from external README...
r17131 #
At which point you close the editor and ``histedit`` starts working. When you
specify a ``fold`` operation, ``histedit`` will open an editor when it folds
those revisions together, offering you a chance to clean up the commit message::
Add beta
***
Add delta
Augie Fackler
histedit: new extension for interactive history editing
r17064
Ben Schmidt
histedit: improve documentation and behaviour of dates...
r31055 Edit the commit message to your liking, then close the editor. The date used
for the commit will be the later of the two commits' dates. For this example,
let's assume that the commit message was changed to ``Add beta and delta.``
After histedit has run and had a chance to remove any old or temporary
revisions it needed, the history looks like this::
Augie Fackler
histedit: add extension docstring from external README...
r17131
@ 2[tip] 989b4d060121 2009-04-27 18:04 -0500 durin42
| Add beta and delta.
|
o 1 081603921c3f 2009-04-27 18:04 -0500 durin42
| Add gamma
|
o 0 d8d2fcd0e319 2009-04-27 18:04 -0500 durin42
Add alpha
Note that ``histedit`` does *not* remove any revisions (even its own temporary
ones) until after it has completed all the editing operations, so it will
probably perform several strip operations when it's done. For the above example,
it had to run strip twice. Strip can be slow depending on a variety of factors,
so you might need to be a little patient. You can choose to keep the original
revisions by passing the ``--keep`` flag.
The ``edit`` operation will drop you back to a command prompt,
allowing you to edit files freely, or even use ``hg record`` to commit
some changes as a separate commit. When you're done, any remaining
uncommitted changes will be committed as well. When done, run ``hg
Ben Schmidt
histedit: improve documentation and behaviour of dates...
r31055 histedit --continue`` to finish this step. If there are uncommitted
changes, you'll be prompted for a new commit message, but the default
commit message will be the original message for the ``edit`` ed
revision, and the date of the original commit will be preserved.
Augie Fackler
histedit: add extension docstring from external README...
r17131
The ``message`` operation will give you a chance to revise a commit
message without changing the contents. It's a shortcut for doing
``edit`` immediately followed by `hg histedit --continue``.
If ``histedit`` encounters a conflict when moving a revision (while
handling ``pick`` or ``fold``), it'll stop in a similar manner to
``edit`` with the difference that it won't prompt you for a commit
message when done. If you decide at this point that you don't like how
much work it will be to rearrange history, or that you made a mistake,
you can use ``hg histedit --abort`` to abandon the new changes you
have made and return to the state before you attempted to edit your
history.
FUJIWARA Katsunori
histedit: correct the number of added revisions in online help...
r18323 If we clone the histedit-ed example repository above and add four more
changes, such that we have the following history::
Augie Fackler
histedit: add extension docstring from external README...
r17131
@ 6[tip] 038383181893 2009-04-27 18:04 -0500 stefan
| Add theta
|
o 5 140988835471 2009-04-27 18:04 -0500 stefan
| Add eta
|
o 4 122930637314 2009-04-27 18:04 -0500 stefan
| Add zeta
|
o 3 836302820282 2009-04-27 18:04 -0500 stefan
| Add epsilon
|
o 2 989b4d060121 2009-04-27 18:04 -0500 durin42
| Add beta and delta.
|
o 1 081603921c3f 2009-04-27 18:04 -0500 durin42
| Add gamma
|
o 0 d8d2fcd0e319 2009-04-27 18:04 -0500 durin42
Add alpha
If you run ``hg histedit --outgoing`` on the clone then it is the same
as running ``hg histedit 836302820282``. If you need plan to push to a
repository that Mercurial does not detect to be related to the source
repo, you can add a ``--force`` option.
Mateusz Kwapich
histedit: add a config allowing changing histedit rule line length limit...
r24199
Mateusz Kwapich
histedit: delete to drop...
r27414 Config
------
Mateusz Kwapich
histedit: add a config allowing changing histedit rule line length limit...
r24199 Histedit rule lines are truncated to 80 characters by default. You
timeless@mozdev.org
histedit: fix English (en-US)
r26171 can customize this behavior by setting a different length in your
FUJIWARA Katsunori
histedit: fix reST syntax problem of example code in help document...
r24869 configuration file::
Mateusz Kwapich
histedit: add a config allowing changing histedit rule line length limit...
r24199
FUJIWARA Katsunori
histedit: fix reST syntax problem of example code in help document...
r24869 [histedit]
linelen = 120 # truncate rule lines at 120 characters
Gregory Szorc
histedit: pick an appropriate base changeset by default (BC)...
r27262
``hg histedit`` attempts to automatically choose an appropriate base
revision to use. To change which base revision is used, define a
revset in your configuration file::
[histedit]
defaultrev = only(.) & draft()
Mateusz Kwapich
histedit: delete to drop...
r27414
By default each edited revision needs to be present in histedit commands.
To remove revision you need to use ``drop`` operation. You can configure
FUJIWARA Katsunori
doc: prevent literal text block from being treated as non-literal one...
r27957 the drop to be implicit for missing commits by adding::
Mateusz Kwapich
histedit: delete to drop...
r27414
[histedit]
dropmissing = True
Durham Goode
histedit: add histedit.singletransaction config option...
r31513 By default, histedit will close the transaction after each action. For
performance purposes, you can configure histedit to use a single transaction
across the entire histedit. WARNING: This setting introduces a significant risk
of losing the work you've done in a histedit if the histedit aborts
unexpectedly::
[histedit]
singletransaction = True
Augie Fackler
histedit: new extension for interactive history editing
r17064 """
Augie Fackler
histedit: add extension docstring from external README...
r17131
Pulkit Goyal
py3: make hgext/hisedit.py use absolute_import
r29126 from __future__ import absolute_import
Augie Fackler
histedit: new extension for interactive history editing
r17064 import os
Yuya Nishihara
py3: move up symbol imports to enforce import-checker rules...
r29205
from mercurial.i18n import _
Pulkit Goyal
py3: make hgext/hisedit.py use absolute_import
r29126 from mercurial import (
bundle2,
cmdutil,
context,
copies,
destutil,
discovery,
error,
exchange,
extensions,
hg,
lock,
merge as mergemod,
Siddharth Agarwal
histedit: make check for unresolved conflicts explicit (issue5545)...
r32057 mergeutil,
Pulkit Goyal
py3: make hgext/hisedit.py use absolute_import
r29126 node,
obsolete,
Pulkit Goyal
py3: handle keyword arguments in hgext/histedit.py...
r35000 pycompat,
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 registrar,
Pulkit Goyal
py3: make hgext/hisedit.py use absolute_import
r29126 repair,
scmutil,
Pulkit Goyal
histedit: add a stateobj variable to histeditstate class...
r38525 state as statemod,
Pulkit Goyal
py3: make hgext/hisedit.py use absolute_import
r29126 util,
)
Yuya Nishihara
stringutil: bulk-replace call sites to point to new module...
r37102 from mercurial.utils import (
stringutil,
)
Augie Fackler
histedit: new extension for interactive history editing
r17064
Pulkit Goyal
py3: conditionalize cPickle import by adding in util...
r29324 pickle = util.pickle
Pulkit Goyal
py3: make hgext/hisedit.py use absolute_import
r29126 release = lock.release
Adrian Buehlmann
histedit: use cmdutil.command decorator
r17147 cmdtable = {}
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 command = registrar.command(cmdtable)
Adrian Buehlmann
histedit: use cmdutil.command decorator
r17147
Boris Feld
configitems: register the 'histedit.defaultrev' config
r34472 configtable = {}
configitem = registrar.configitem(configtable)
Boris Feld
configitems: register the 'experimental.histedit.autoverb' config
r34476 configitem('experimental', 'histedit.autoverb',
default=False,
)
Boris Feld
configitems: register the 'histedit.defaultrev' config
r34472 configitem('histedit', 'defaultrev',
Boris Feld
histedit: use the new stack definition for histedit...
r37021 default=None,
Boris Feld
configitems: register the 'histedit.defaultrev' config
r34472 )
Boris Feld
configitems: register the 'histedit.dropmissing' config
r34473 configitem('histedit', 'dropmissing',
default=False,
)
Boris Feld
configitems: register the 'histedit.linelen' config
r34474 configitem('histedit', 'linelen',
default=80,
)
Boris Feld
configitems: register the 'histedit.singletransaction' config
r34475 configitem('histedit', 'singletransaction',
default=False,
)
Boris Feld
configitems: register the 'histedit.defaultrev' config
r34472
Augie Fackler
extensions: change magic "shipped with hg" string...
r29841 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
Augie Fackler
extensions: document that `testedwith = 'internal'` is special...
r25186 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
# be specifying the version(s) of Mercurial they are tested with, or
# leave the attribute unspecified.
Augie Fackler
extensions: change magic "shipped with hg" string...
r29841 testedwith = 'ships-with-hg-core'
Augie Fackler
histedit: new extension for interactive history editing
r17064
timeless
histedit: replace @addhisteditaction with @action...
r27675 actiontable = {}
primaryactions = set()
secondaryactions = set()
tertiaryactions = set()
internalactions = set()
Mateusz Kwapich
histedit: add a hint about enabled dropmissing to histedit edit comment...
r28592 def geteditcomment(ui, first, last):
timeless
histedit: replace editcomment with a function
r27673 """ construct the editor comment
The comment includes::
- an intro
timeless
histedit: prefer edit commit, edit message, use commit...
r27674 - sorted primary commands
- sorted short commands
timeless
histedit: replace @addhisteditaction with @action...
r27675 - sorted long commands
Mateusz Kwapich
histedit: add a hint about enabled dropmissing to histedit edit comment...
r28592 - additional hints
timeless
histedit: replace editcomment with a function
r27673
Commands are only included once.
"""
intro = _("""Edit history between %s and %s
Commits are listed from least to most recent
liscju
histedit: adds hint how to reorder changesets at editor (issue3766)
r28396 You can reorder changesets by reordering the lines
timeless
histedit: replace @addhisteditaction with @action...
r27675 Commands:
FUJIWARA Katsunori
histedit: make comment part of the file describing rules as translatable...
r17315 """)
timeless
histedit: replace @addhisteditaction with @action...
r27675 actions = []
def addverb(v):
a = actiontable[v]
lines = a.message.split("\n")
if len(a.verbs):
v = ', '.join(sorted(a.verbs, key=lambda v: len(v)))
actions.append(" %s = %s" % (v, lines[0]))
actions.extend([' %s' for l in lines[1:]])
for v in (
sorted(primaryactions) +
sorted(secondaryactions) +
sorted(tertiaryactions)
):
addverb(v)
actions.append('')
Augie Fackler
histedit: new extension for interactive history editing
r17064
Mateusz Kwapich
histedit: add a hint about enabled dropmissing to histedit edit comment...
r28592 hints = []
if ui.configbool('histedit', 'dropmissing'):
hints.append("Deleting a changeset from the list "
"will DISCARD it from the edited history!")
lines = (intro % (first, last)).split('\n') + actions + hints
return ''.join(['# %s\n' % l if l else '#\n' for l in lines])
timeless
histedit: replace editcomment with a function
r27673
David Soria Parra
histedit: add histedit state class...
r22976 class histeditstate(object):
Mateusz Kwapich
histedit: get rid of state.rules...
r27208 def __init__(self, repo, parentctxnode=None, actions=None, keep=None,
David Soria Parra
histedit: move locks into state...
r22984 topmost=None, replacements=None, lock=None, wlock=None):
David Soria Parra
histedit: add histedit state class...
r22976 self.repo = repo
Mateusz Kwapich
histedit: get rid of state.rules...
r27208 self.actions = actions
David Soria Parra
histedit: add histedit state class...
r22976 self.keep = keep
self.topmost = topmost
Mateusz Kwapich
histedit: switch state to store node instead of ctx...
r24112 self.parentctxnode = parentctxnode
David Soria Parra
histedit: move locks into state...
r22984 self.lock = lock
self.wlock = wlock
Durham Goode
histedit: store backup file before histedit...
r24757 self.backupfile = None
Pulkit Goyal
histedit: add a stateobj variable to histeditstate class...
r38525 self.stateobj = statemod.cmdstate(repo, 'histedit-state')
David Soria Parra
histedit: add histedit state class...
r22976 if replacements is None:
self.replacements = []
else:
self.replacements = replacements
David Soria Parra
histedit: read state from histeditstate...
r22983 def read(self):
Augie Fackler
histedit: update docstring on histeditstate.read()...
r22986 """Load histedit state from disk and set fields appropriately."""
Pulkit Goyal
histedit: use self.stateobj to check whether interrupted histedit exists...
r38526 if not self.stateobj.exists():
timeless
histedit: suggest the correct tool to continue (not histedit)...
r28123 cmdutil.wrongtooltocontinue(self.repo, _('histedit'))
David Soria Parra
histedit: read state from histeditstate...
r22983
Pulkit Goyal
histedit: use self.stateobj to check whether interrupted histedit exists...
r38526 data = self._read()
Pulkit Goyal
histedit: factor out logic of processing state data in separate fn...
r38524
self.parentctxnode = data['parentctxnode']
actions = parserules(data['rules'], self)
self.actions = actions
self.keep = data['keep']
self.topmost = data['topmost']
self.replacements = data['replacements']
self.backupfile = data['backupfile']
Pulkit Goyal
histedit: use self.stateobj to check whether interrupted histedit exists...
r38526 def _read(self):
fp = self.repo.vfs.read('histedit-state')
Pulkit Goyal
histedit: factor out logic of processing state data in separate fn...
r38524 if fp.startswith('v1\n'):
Bryan O'Sullivan
histedit: only use pickle if not using the modern save format...
r27527 data = self._load()
parentctxnode, rules, keep, topmost, replacements, backupfile = data
else:
Pulkit Goyal
histedit: factor out logic of processing state data in separate fn...
r38524 data = pickle.loads(fp)
Durham Goode
histedit: replace pickle with custom serialization...
r24756 parentctxnode, rules, keep, topmost, replacements = data
Durham Goode
histedit: store backup file before histedit...
r24757 backupfile = None
Pulkit Goyal
histedit: factor out logic of processing state data in separate fn...
r38524 rules = "\n".join(["%s %s" % (verb, rest) for [verb, rest] in rules])
David Soria Parra
histedit: read state from histeditstate...
r22983
Pulkit Goyal
histedit: factor out logic of processing state data in separate fn...
r38524 return {'parentctxnode': parentctxnode, "rules": rules, "keep": keep,
"topmost": topmost, "replacements": replacements,
"backupfile": backupfile}
David Soria Parra
histedit: read state from histeditstate...
r22983
Durham Goode
histedit: add transaction support to writing the state file...
r31511 def write(self, tr=None):
if tr:
tr.addfilegenerator('histedit-state', ('histedit-state',),
self._write, location='plain')
else:
with self.repo.vfs("histedit-state", "w") as f:
self._write(f)
def _write(self, fp):
Durham Goode
histedit: replace pickle with custom serialization...
r24756 fp.write('v1\n')
fp.write('%s\n' % node.hex(self.parentctxnode))
fp.write('%s\n' % node.hex(self.topmost))
Augie Fackler
histedit: convert bool to bytestring manually...
r36185 fp.write('%s\n' % ('True' if self.keep else 'False'))
Mateusz Kwapich
histedit: get rid of state.rules...
r27208 fp.write('%d\n' % len(self.actions))
for action in self.actions:
fp.write('%s\n' % action.tostate())
Durham Goode
histedit: replace pickle with custom serialization...
r24756 fp.write('%d\n' % len(self.replacements))
for replacement in self.replacements:
fp.write('%s%s\n' % (node.hex(replacement[0]), ''.join(node.hex(r)
for r in replacement[1])))
Durham Goode
histedit: fix serializing of None backupfile...
r24958 backupfile = self.backupfile
if not backupfile:
backupfile = ''
fp.write('%s\n' % backupfile)
David Soria Parra
histedit: add histedit state class...
r22976
Durham Goode
histedit: replace pickle with custom serialization...
r24756 def _load(self):
fp = self.repo.vfs('histedit-state', 'r')
lines = [l[:-1] for l in fp.readlines()]
index = 0
lines[index] # version number
index += 1
parentctxnode = node.bin(lines[index])
index += 1
topmost = node.bin(lines[index])
index += 1
keep = lines[index] == 'True'
index += 1
# Rules
rules = []
rulelen = int(lines[index])
index += 1
Gregory Szorc
global: use pycompat.xrange()...
r38806 for i in pycompat.xrange(rulelen):
Durham Goode
histedit: change state format to allow non-hash lines...
r24810 ruleaction = lines[index]
index += 1
Durham Goode
histedit: replace pickle with custom serialization...
r24756 rule = lines[index]
index += 1
Durham Goode
histedit: change state format to allow non-hash lines...
r24810 rules.append((ruleaction, rule))
Durham Goode
histedit: replace pickle with custom serialization...
r24756
# Replacements
replacements = []
replacementlen = int(lines[index])
index += 1
Gregory Szorc
global: use pycompat.xrange()...
r38806 for i in pycompat.xrange(replacementlen):
Durham Goode
histedit: replace pickle with custom serialization...
r24756 replacement = lines[index]
original = node.bin(replacement[:40])
succ = [node.bin(replacement[i:i + 40]) for i in
range(40, len(replacement), 40)]
replacements.append((original, succ))
index += 1
Durham Goode
histedit: store backup file before histedit...
r24757 backupfile = lines[index]
index += 1
Durham Goode
histedit: replace pickle with custom serialization...
r24756 fp.close()
Durham Goode
histedit: store backup file before histedit...
r24757 return parentctxnode, rules, keep, topmost, replacements, backupfile
Durham Goode
histedit: replace pickle with custom serialization...
r24756
David Soria Parra
histedit: add clear method to remove state...
r22978 def clear(self):
Christian Delahousse
histedit: check presence of statefile before deleting it...
r26583 if self.inprogress():
self.repo.vfs.unlink('histedit-state')
David Soria Parra
histedit: add clear method to remove state...
r22978
Christian Delahousse
histedit: add inprogress method to state class...
r26582 def inprogress(self):
return self.repo.vfs.exists('histedit-state')
Mateusz Kwapich
histedit: add actions property to histedit state...
r27200
Durham Goode
histedit: add a new histeditaction class...
r24765 class histeditaction(object):
def __init__(self, state, node):
self.state = state
self.repo = state.repo
self.node = node
@classmethod
def fromrule(cls, state, rule):
"""Parses the given rule, returning an instance of the histeditaction.
"""
Sangeet Kumar Mishra
histedit: make histedit's commands accept revsets (issue5746)...
r37124 ruleid = rule.strip().split(' ', 1)[0]
# ruleid can be anything from rev numbers, hashes, "bookmarks" etc
# Check for validation of rule ids and get the rulehash
timeless
histedit: handle exceptions from node.bin in fromrule
r27547 try:
Sangeet Kumar Mishra
histedit: make histedit's commands accept revsets (issue5746)...
r37124 rev = node.bin(ruleid)
Augie Fackler
node: make bin() be a wrapper instead of just an alias...
r36256 except TypeError:
Sangeet Kumar Mishra
histedit: make histedit's commands accept revsets (issue5746)...
r37124 try:
_ctx = scmutil.revsingle(state.repo, ruleid)
rulehash = _ctx.hex()
rev = node.bin(rulehash)
except error.RepoLookupError:
Sangeet Kumar Mishra
histedit: make errror message translatable...
r37285 raise error.ParseError(_("invalid changeset %s") % ruleid)
timeless
histedit: handle exceptions from node.bin in fromrule
r27547 return cls(state, rev)
Mateusz Kwapich
histedit: add verify() to histeditaction...
r27202
Pierre-Yves David
histedit: move constraint verification to the 'action.verify' method...
r29879 def verify(self, prev, expected, seen):
Mateusz Kwapich
histedit: add verify() to histeditaction...
r27202 """ Verifies semantic correctness of the rule"""
repo = self.repo
ha = node.hex(self.node)
Martin von Zweigbergk
scmutil: rename resolvepartialhexnodeid() to resolvehexnodeidprefix()...
r37696 self.node = scmutil.resolvehexnodeidprefix(repo, ha)
Martin von Zweigbergk
histedit: look up partial nodeid as partial nodeid...
r37524 if self.node is None:
raise error.ParseError(_('unknown changeset %s listed') % ha[:12])
Martin von Zweigbergk
histedit: drop unnecessary check for "self.node is not None"...
r37523 self._verifynodeconstraints(prev, expected, seen)
Pierre-Yves David
histedit: move constraint verification to the 'action.verify' method...
r29879
Pierre-Yves David
histedt: use inheritance to override the constraints in 'base'...
r29880 def _verifynodeconstraints(self, prev, expected, seen):
# by default command need a node in the edited list
if self.node not in expected:
raise error.ParseError(_('%s "%s" changeset was not a candidate')
% (self.verb, node.short(self.node)),
hint=_('only use listed changesets'))
# and only one command per node
if self.node in seen:
raise error.ParseError(_('duplicated command for changeset %s') %
node.short(self.node))
Durham Goode
histedit: add a new histeditaction class...
r24765
Sean Farley
histedit: remove unneeded initial parameter...
r29466 def torule(self):
Mateusz Kwapich
histedit: add torule method to histedit action objects...
r27203 """build a histedit rule line for an action
by default lines are in the form:
<hash> <rev> <summary>
"""
ctx = self.repo[self.node]
Sean Farley
histedit: use _getsummary in torule...
r29468 summary = _getsummary(ctx)
Mateusz Kwapich
histedit: add torule method to histedit action objects...
r27203 line = '%s %s %d %s' % (self.verb, ctx, ctx.rev(), summary)
# trim to 75 columns by default so it's not stupidly wide in my editor
# (the 5 more are left for verb)
Boris Feld
configitems: register the 'histedit.linelen' config
r34474 maxlen = self.repo.ui.configint('histedit', 'linelen')
Mateusz Kwapich
histedit: add torule method to histedit action objects...
r27203 maxlen = max(maxlen, 22) # avoid truncating hash
Yuya Nishihara
stringutil: bulk-replace call sites to point to new module...
r37102 return stringutil.ellipsis(line, maxlen)
Mateusz Kwapich
histedit: add torule method to histedit action objects...
r27203
Mateusz Kwapich
histedit: add tostate method to histedit action...
r27206 def tostate(self):
"""Print an action in format used by histedit state files
(the first line is a verb, the remainder is the second)
"""
return "%s\n%s" % (self.verb, node.hex(self.node))
Durham Goode
histedit: add a new histeditaction class...
r24765 def run(self):
"""Runs the action. The default behavior is simply apply the action's
rulectx onto the current parentctx."""
self.applychange()
self.continuedirty()
return self.continueclean()
def applychange(self):
"""Applies the changes from this action's rulectx onto the current
parentctx, but does not commit them."""
repo = self.repo
rulectx = repo[self.node]
timeless
histedit: limit updated and merging output to important updates...
r28004 repo.ui.pushbuffer(error=True, labeled=True)
timeless
histedit: omit useless message from update (histeditaction)...
r27405 hg.update(repo, self.state.parentctxnode, quietempty=True)
Durham Goode
histedit: add a new histeditaction class...
r24765 stats = applychanges(repo.ui, repo, rulectx, {})
Boris Feld
histedit: preserve active branch while histediting...
r35391 repo.dirstate.setbranch(rulectx.branch())
Gregory Szorc
merge: deprecate accessing update results by index...
r37143 if stats.unresolvedcount:
timeless
histedit: limit updated and merging output to important updates...
r28004 buf = repo.ui.popbuffer()
Augie Fackler
histedit: fix silly bug that was unpacking a bytestr before writing it...
r36188 repo.ui.write(buf)
timeless
histedit: list action when intervention is required
r27629 raise error.InterventionRequired(
_('Fix up the change (%s %s)') %
(self.verb, node.short(self.node)),
hint=_('hg histedit --continue to resume'))
timeless
histedit: limit updated and merging output to important updates...
r28004 else:
repo.ui.popbuffer()
Durham Goode
histedit: add a new histeditaction class...
r24765
def continuedirty(self):
"""Continues the action when changes have been applied to the working
copy. The default behavior is to commit the dirty changes."""
repo = self.repo
rulectx = repo[self.node]
editor = self.commiteditor()
commit = commitfuncfor(repo, rulectx)
commit(text=rulectx.description(), user=rulectx.user(),
date=rulectx.date(), extra=rulectx.extra(), editor=editor)
def commiteditor(self):
"""The editor to be used to edit the commit message."""
return False
def continueclean(self):
"""Continues the action when the working copy is clean. The default
behavior is to accept the current commit as the new version of the
rulectx."""
ctx = self.repo['.']
if ctx.node() == self.state.parentctxnode:
timeless
histedit: reword message when a changeset produces no changes...
r28340 self.repo.ui.warn(_('%s: skipping changeset (no changes)\n') %
Durham Goode
histedit: add a new histeditaction class...
r24765 node.short(self.node))
return ctx, [(self.node, tuple())]
if ctx.node() == self.node:
# Nothing changed
return ctx, []
return ctx, [(self.node, (ctx.node(),))]
Pierre-Yves David
histedit: factor most commit creation in a function...
r18436 def commitfuncfor(repo, src):
"""Build a commit function for the replacement of <src>
Mads Kiilerich
spelling: fix some minor issues found by spell checker
r18644 This function ensure we apply the same treatment to all changesets.
Pierre-Yves David
histedit: factor most commit creation in a function...
r18436
Pierre-Yves David
histedit: record histedit source (issue3681)...
r18437 - Add a 'histedit_source' entry in extra.
Pierre-Yves David
histedit: factor most commit creation in a function...
r18436
Augie Fackler
histedit: copyedit docstring wording problem I noticed while here
r25450 Note that fold has its own separated logic because its handling is a bit
Pierre-Yves David
histedit: factor most commit creation in a function...
r18436 different and not easily factored out of the fold method.
"""
Pierre-Yves David
histedit: proper phase conservation (issue3724)...
r18440 phasemin = src.phase()
Pierre-Yves David
histedit: factor most commit creation in a function...
r18436 def commitfunc(**kwargs):
Jun Wu
histedit: get rid of ui.backupconfig
r31459 overrides = {('phases', 'new-commit'): phasemin}
with repo.ui.configoverride(overrides, 'histedit'):
Pulkit Goyal
py3: handle keyword arguments in hgext/histedit.py...
r35000 extra = kwargs.get(r'extra', {}).copy()
Pierre-Yves David
histedit: proper phase conservation (issue3724)...
r18440 extra['histedit_source'] = src.hex()
Pulkit Goyal
py3: handle keyword arguments in hgext/histedit.py...
r35000 kwargs[r'extra'] = extra
Pierre-Yves David
histedit: proper phase conservation (issue3724)...
r18440 return repo.commit(**kwargs)
Pierre-Yves David
histedit: factor most commit creation in a function...
r18436 return commitfunc
Pierre-Yves David
histedit: replaces patching logic by merges...
r17647 def applychanges(ui, repo, ctx, opts):
"""Merge changeset from ctx (only) in the current working directory"""
wcpar = repo.dirstate.parents()[0]
if ctx.p1().node() == wcpar:
timeless@mozdev.org
histedit: fix English (en-US)
r26171 # edits are "in place" we do not need to make any merge,
timeless
histedit: fix comment in applychanges
r27603 # just applies changes on parent for editing
Pierre-Yves David
histedit: replaces patching logic by merges...
r17647 cmdutil.revert(ui, repo, ctx, (wcpar, node.nullid), all=True)
Gregory Szorc
histedit: always define update results...
r37126 stats = mergemod.updateresult(0, 0, 0, 0)
Pierre-Yves David
histedit: replaces patching logic by merges...
r17647 else:
try:
# ui.forcemerge is an internal variable, do not document
Mads Kiilerich
config: set a 'source' in most cases where config don't come from file but code...
r20790 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
'histedit')
Matt Mackall
histedit: use merge.graft
r22904 stats = mergemod.graft(repo, ctx, ctx.p1(), ['local', 'histedit'])
Pierre-Yves David
histedit: replaces patching logic by merges...
r17647 finally:
Mads Kiilerich
config: set a 'source' in most cases where config don't come from file but code...
r20790 repo.ui.setconfig('ui', 'forcemerge', '', 'histedit')
Pierre-Yves David
histedit: replaces patching logic by merges...
r17647 return stats
Leah Xue
histedit: factored out diff/patch logic...
r17407
Gregory Szorc
histedit: rename variables so they have "ctx" in them...
r36421 def collapse(repo, firstctx, lastctx, commitopts, skipprompt=False):
Pierre-Yves David
histedit: fold in memory...
r17644 """collapse the set of revisions from first to last as new one.
Expected commit options are:
- message
- date
- username
Mads Kiilerich
spelling: fix minor spell checker issues
r17738 Commit message is edited in all cases.
Pierre-Yves David
histedit: fold in memory...
r17644
This function works in memory."""
Gregory Szorc
histedit: use ctx.rev() instead of %d % ctx...
r36422 ctxs = list(repo.set('%d::%d', firstctx.rev(), lastctx.rev()))
Pierre-Yves David
histedit: fold in memory...
r17644 if not ctxs:
return None
Augie Fackler
histedit: abort rather than edit a public changeset (issue4704)...
r25452 for c in ctxs:
if not c.mutable():
timeless
histedit: use parse-error exception for parsing
r27545 raise error.ParseError(
Augie Fackler
histedit: abort rather than edit a public changeset (issue4704)...
r25452 _("cannot fold into public change %s") % node.short(c.node()))
Gregory Szorc
histedit: rename variables so they have "ctx" in them...
r36421 base = firstctx.parents()[0]
Pierre-Yves David
histedit: fold in memory...
r17644
# commit a new version of the old changeset, including the update
# collect all files which might be affected
files = set()
for ctx in ctxs:
files.update(ctx.files())
# Recompute copies (avoid recording a -> b -> a)
Gregory Szorc
histedit: rename variables so they have "ctx" in them...
r36421 copied = copies.pathcopies(base, lastctx)
Pierre-Yves David
histedit: fold in memory...
r17644
# prune files which were reverted by the updates
Gregory Szorc
histedit: rename variables so they have "ctx" in them...
r36421 files = [f for f in files if not cmdutil.samefile(f, lastctx, base)]
Pierre-Yves David
histedit: fold in memory...
r17644 # commit version of these files as defined by head
Gregory Szorc
histedit: rename variables so they have "ctx" in them...
r36421 headmf = lastctx.manifest()
Pierre-Yves David
histedit: fold in memory...
r17644 def filectxfn(repo, ctx, path):
if path in headmf:
Gregory Szorc
histedit: rename variables so they have "ctx" in them...
r36421 fctx = lastctx[path]
Pierre-Yves David
histedit: fold in memory...
r17644 flags = fctx.flags()
Martin von Zweigbergk
memfilectx: make changectx argument mandatory in constructor (API)...
r35401 mctx = context.memfilectx(repo, ctx,
Sean Farley
memfilectx: call super.__init__ instead of duplicating code...
r21689 fctx.path(), fctx.data(),
Pierre-Yves David
histedit: fold in memory...
r17644 islink='l' in flags,
isexec='x' in flags,
copied=copied.get(path))
return mctx
Mads Kiilerich
convert: use None value for missing files instead of overloading IOError...
r22296 return None
Pierre-Yves David
histedit: fold in memory...
r17644
if commitopts.get('message'):
message = commitopts['message']
else:
Gregory Szorc
histedit: rename variables so they have "ctx" in them...
r36421 message = firstctx.description()
Pierre-Yves David
histedit: fold in memory...
r17644 user = commitopts.get('user')
date = commitopts.get('date')
Pierre-Yves David
histedit: record histedit source (issue3681)...
r18437 extra = commitopts.get('extra')
Pierre-Yves David
histedit: fold in memory...
r17644
Gregory Szorc
histedit: rename variables so they have "ctx" in them...
r36421 parents = (firstctx.p1().node(), firstctx.p2().node())
Mike Edgar
histedit: add "roll" command to fold commit data and drop message (issue4256)...
r22152 editor = None
Durham Goode
histedit: fix rollup prompting for a commit message (issue4606)...
r24828 if not skipprompt:
Mike Edgar
histedit: add "roll" command to fold commit data and drop message (issue4256)...
r22152 editor = cmdutil.getcommiteditor(edit=True, editform='histedit.fold')
Pierre-Yves David
histedit: fold in memory...
r17644 new = context.memctx(repo,
parents=parents,
text=message,
files=files,
filectxfn=filectxfn,
user=user,
date=date,
FUJIWARA Katsunori
histedit: pass "editor" argument to "memctx.__init__()" for "collapse" command...
r21239 extra=extra,
FUJIWARA Katsunori
histedit: pass 'editform' argument to 'cmdutil.getcommiteditor'...
r22002 editor=editor)
Pierre-Yves David
histedit: fold in memory...
r17644 return repo.commitctx(new)
liscju
histedit: extracts _isdirtywc function...
r26981 def _isdirtywc(repo):
return repo[None].dirty(missing=True)
Mateusz Kwapich
histedit: add abortdirty function...
r27084 def abortdirty():
raise error.Abort(_('working copy has pending changes'),
hint=_('amend, commit, or revert them and run histedit '
'--continue, or abort with histedit --abort'))
timeless
histedit: replace @addhisteditaction with @action...
r27675 def action(verbs, message, priority=False, internal=False):
def wrap(cls):
assert not priority or not internal
verb = verbs[0]
if priority:
primaryactions.add(verb)
elif internal:
internalactions.add(verb)
elif len(verbs) > 1:
secondaryactions.add(verb)
else:
tertiaryactions.add(verb)
Mateusz Kwapich
histedit: add addhisteditaction decorator...
r27201
timeless
histedit: replace @addhisteditaction with @action...
r27675 cls.verb = verb
cls.verbs = verbs
cls.message = message
Mateusz Kwapich
histedit: add addhisteditaction decorator...
r27201 for verb in verbs:
actiontable[verb] = cls
return cls
return wrap
timeless
histedit: replace @addhisteditaction with @action...
r27675 @action(['pick', 'p'],
_('use commit'),
priority=True)
Durham Goode
histedit: convert pick action into a class...
r24767 class pick(histeditaction):
def run(self):
rulectx = self.repo[self.node]
if rulectx.parents()[0].node() == self.state.parentctxnode:
self.repo.ui.debug('node %s unchanged\n' % node.short(self.node))
return rulectx, []
Augie Fackler
histedit: new extension for interactive history editing
r17064
Durham Goode
histedit: convert pick action into a class...
r24767 return super(pick, self).run()
Augie Fackler
histedit: new extension for interactive history editing
r17064
timeless
histedit: replace @addhisteditaction with @action...
r27675 @action(['edit', 'e'],
_('use commit, but stop for amending'),
priority=True)
Durham Goode
histedit: convert edit action into a class...
r24770 class edit(histeditaction):
def run(self):
repo = self.repo
rulectx = repo[self.node]
timeless
histedit: omit useless message from update (edit)...
r27407 hg.update(repo, self.state.parentctxnode, quietempty=True)
Durham Goode
histedit: convert edit action into a class...
r24770 applychanges(repo.ui, repo, rulectx, {})
raise error.InterventionRequired(
timeless
histedit: list action when intervention is required
r27629 _('Editing (%s), you may commit or record as needed now.')
% node.short(self.node),
hint=_('hg histedit --continue to resume'))
Durham Goode
histedit: convert edit action into a class...
r24770
def commiteditor(self):
return cmdutil.getcommiteditor(edit=True, editform='histedit.edit')
Augie Fackler
histedit: new extension for interactive history editing
r17064
timeless
histedit: replace @addhisteditaction with @action...
r27675 @action(['fold', 'f'],
_('use commit, but combine it with the one above'))
Durham Goode
histedit: convert fold/roll actions into a class...
r24771 class fold(histeditaction):
Pierre-Yves David
histedit: move constraint verification to the 'action.verify' method...
r29879 def verify(self, prev, expected, seen):
timeless
histedit: check fold of public change during verify
r27542 """ Verifies semantic correctness of the fold rule"""
Pierre-Yves David
histedit: move constraint verification to the 'action.verify' method...
r29879 super(fold, self).verify(prev, expected, seen)
timeless
histedit: check fold of public change during verify
r27542 repo = self.repo
if not prev:
c = repo[self.node].parents()[0]
elif not prev.verb in ('pick', 'base'):
return
else:
c = repo[prev.node]
if not c.mutable():
timeless
histedit: use parse-error exception for parsing
r27545 raise error.ParseError(
timeless
histedit: check fold of public change during verify
r27542 _("cannot fold into public change %s") % node.short(c.node()))
Durham Goode
histedit: convert fold/roll actions into a class...
r24771 def continuedirty(self):
repo = self.repo
rulectx = repo[self.node]
commit = commitfuncfor(repo, rulectx)
commit(text='fold-temp-revision %s' % node.short(self.node),
user=rulectx.user(), date=rulectx.date(),
extra=rulectx.extra())
def continueclean(self):
repo = self.repo
ctx = repo['.']
rulectx = repo[self.node]
parentctxnode = self.state.parentctxnode
if ctx.node() == parentctxnode:
repo.ui.warn(_('%s: empty changeset\n') %
node.short(self.node))
return ctx, [(self.node, (parentctxnode,))]
Mike Edgar
histedit: add "roll" command to fold commit data and drop message (issue4256)...
r22152
Durham Goode
histedit: convert fold/roll actions into a class...
r24771 parentctx = repo[parentctxnode]
Gregory Szorc
histedit: use ctx.rev() instead of %d % ctx...
r36422 newcommits = set(c.node() for c in repo.set('(%d::. - %d)',
parentctx.rev(),
parentctx.rev()))
Durham Goode
histedit: convert fold/roll actions into a class...
r24771 if not newcommits:
repo.ui.warn(_('%s: cannot fold - working copy is not a '
'descendant of previous commit %s\n') %
(node.short(self.node), node.short(parentctxnode)))
return ctx, [(self.node, (ctx.node(),))]
middlecommits = newcommits.copy()
middlecommits.discard(ctx.node())
Durham Goode
histedit: improve roll action integration with fold...
r24773 return self.finishfold(repo.ui, repo, parentctx, rulectx, ctx.node(),
middlecommits)
Durham Goode
histedit: convert fold/roll actions into a class...
r24771
Durham Goode
histedit: improve roll action integration with fold...
r24773 def skipprompt(self):
Augie Fackler
histedit: use one editor when multiple folds happen in a row (issue3524) (BC)...
r26246 """Returns true if the rule should skip the message editor.
For example, 'fold' wants to show an editor, but 'rollup'
doesn't want to.
"""
Durham Goode
histedit: improve roll action integration with fold...
r24773 return False
Durham Goode
histedit: move finishfold into fold class...
r24772
Augie Fackler
histedit: use one editor when multiple folds happen in a row (issue3524) (BC)...
r26246 def mergedescs(self):
"""Returns true if the rule should merge messages of multiple changes.
This exists mainly so that 'rollup' rules can be a subclass of
'fold'.
"""
return True
Ben Schmidt
histedit: modify rollup to discard date from the rollup commit (issue4820)...
r31056 def firstdate(self):
"""Returns true if the rule should preserve the date of the first
change.
This exists mainly so that 'rollup' rules can be a subclass of
'fold'.
"""
return False
Durham Goode
histedit: improve roll action integration with fold...
r24773 def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges):
Durham Goode
histedit: move finishfold into fold class...
r24772 parent = ctx.parents()[0].node()
Yuya Nishihara
cleanup: pass in overwrite flag to hg.updaterepo() as named argument...
r38527 hg.updaterepo(repo, parent, overwrite=False)
Durham Goode
histedit: move finishfold into fold class...
r24772 ### prepare new commit data
Durham Goode
histedit: improve roll action integration with fold...
r24773 commitopts = {}
Durham Goode
histedit: move finishfold into fold class...
r24772 commitopts['user'] = ctx.user()
# commit message
Augie Fackler
histedit: use one editor when multiple folds happen in a row (issue3524) (BC)...
r26246 if not self.mergedescs():
Durham Goode
histedit: move finishfold into fold class...
r24772 newmessage = ctx.description()
else:
newmessage = '\n***\n'.join(
[ctx.description()] +
[repo[r].description() for r in internalchanges] +
[oldctx.description()]) + '\n'
commitopts['message'] = newmessage
# date
Ben Schmidt
histedit: modify rollup to discard date from the rollup commit (issue4820)...
r31056 if self.firstdate():
commitopts['date'] = ctx.date()
else:
commitopts['date'] = max(ctx.date(), oldctx.date())
Durham Goode
histedit: move finishfold into fold class...
r24772 extra = ctx.extra().copy()
# histedit_source
# note: ctx is likely a temporary commit but that the best we can do
# here. This is sufficient to solve issue3681 anyway.
extra['histedit_source'] = '%s,%s' % (ctx.hex(), oldctx.hex())
commitopts['extra'] = extra
Jun Wu
histedit: get rid of ui.backupconfig
r31459 phasemin = max(ctx.phase(), oldctx.phase())
overrides = {('phases', 'new-commit'): phasemin}
with repo.ui.configoverride(overrides, 'histedit'):
Durham Goode
histedit: fix rollup prompting for a commit message (issue4606)...
r24828 n = collapse(repo, ctx, repo[newnode], commitopts,
skipprompt=self.skipprompt())
Durham Goode
histedit: move finishfold into fold class...
r24772 if n is None:
return ctx, []
Yuya Nishihara
cleanup: pass in overwrite flag to hg.updaterepo() as named argument...
r38527 hg.updaterepo(repo, n, overwrite=False)
Durham Goode
histedit: move finishfold into fold class...
r24772 replacements = [(oldctx.node(), (newnode,)),
(ctx.node(), (n,)),
(newnode, (n,)),
]
for ich in internalchanges:
replacements.append((ich, (n,)))
return repo[n], replacements
Durham Goode
histedit: convert fold/roll actions into a class...
r24771
Saurabh Singh
histedit: removing the experimental config 'histeditng'...
r34490 @action(['base', 'b'],
_('checkout changeset and apply further changesets from there'))
Mateusz Kwapich
histedit: add an experimental base action...
r27085 class base(histeditaction):
def run(self):
if self.repo['.'].node() != self.node:
Augie Fackler
merge: have merge.update use a matcher instead of partial fn...
r27344 mergemod.update(self.repo, self.node, False, True)
# branchmerge, force)
Mateusz Kwapich
histedit: add an experimental base action...
r27085 return self.continueclean()
def continuedirty(self):
abortdirty()
def continueclean(self):
basectx = self.repo['.']
return basectx, []
Pierre-Yves David
histedt: use inheritance to override the constraints in 'base'...
r29880 def _verifynodeconstraints(self, prev, expected, seen):
# base can only be use with a node not in the edited set
if self.node in expected:
Augie Fackler
histedit: correct output of error when 'base' is from the edit list...
r29887 msg = _('%s "%s" changeset was an edited list candidate')
raise error.ParseError(
msg % (self.verb, node.short(self.node)),
hint=_('base must only use unlisted changesets'))
Pierre-Yves David
histedt: use inheritance to override the constraints in 'base'...
r29880
timeless
histedit: replace @addhisteditaction with @action...
r27675 @action(['_multifold'],
_(
Augie Fackler
histedit: use one editor when multiple folds happen in a row (issue3524) (BC)...
r26246 """fold subclass used for when multiple folds happen in a row
We only want to fire the editor for the folded message once when
(say) four changes are folded down into a single change. This is
similar to rollup, but we should preserve both messages so that
when the last fold operation runs we can show the user all the
commit messages in their editor.
timeless
histedit: replace @addhisteditaction with @action...
r27675 """),
internal=True)
class _multifold(fold):
Augie Fackler
histedit: use one editor when multiple folds happen in a row (issue3524) (BC)...
r26246 def skipprompt(self):
return True
timeless
histedit: replace @addhisteditaction with @action...
r27675 @action(["roll", "r"],
Ben Schmidt
histedit: modify rollup to discard date from the rollup commit (issue4820)...
r31056 _("like fold, but discard this commit's description and date"))
Durham Goode
histedit: convert fold/roll actions into a class...
r24771 class rollup(fold):
Augie Fackler
histedit: use one editor when multiple folds happen in a row (issue3524) (BC)...
r26246 def mergedescs(self):
return False
Durham Goode
histedit: improve roll action integration with fold...
r24773 def skipprompt(self):
return True
Augie Fackler
histedit: new extension for interactive history editing
r17064
Ben Schmidt
histedit: modify rollup to discard date from the rollup commit (issue4820)...
r31056 def firstdate(self):
return True
timeless
histedit: replace @addhisteditaction with @action...
r27675 @action(["drop", "d"],
_('remove commit from history'))
Durham Goode
histedit: convert drop action into a class...
r24768 class drop(histeditaction):
def run(self):
parentctx = self.repo[self.state.parentctxnode]
return parentctx, [(self.node, tuple())]
Augie Fackler
histedit: new extension for interactive history editing
r17064
timeless
histedit: replace @addhisteditaction with @action...
r27675 @action(["mess", "m"],
_('edit commit message without changing commit content'),
priority=True)
Durham Goode
histedit: convert message action into a class...
r24769 class message(histeditaction):
def commiteditor(self):
return cmdutil.getcommiteditor(edit=True, editform='histedit.mess')
Augie Fackler
histedit: new extension for interactive history editing
r17064
Pierre-Yves David
histedit: remove a mutable default argument...
r26335 def findoutgoing(ui, repo, remote=None, force=False, opts=None):
Pierre-Yves David
histedit: move outgoing processing to its own function...
r19021 """utility function to find the first outgoing changeset
timeless@mozdev.org
histedit: fix English (en-US)
r26171 Used by initialization code"""
Pierre-Yves David
histedit: remove a mutable default argument...
r26335 if opts is None:
opts = {}
Pierre-Yves David
histedit: move outgoing processing to its own function...
r19021 dest = ui.expandpath(remote or 'default-push', remote or 'default')
Martin von Zweigbergk
parseurl: consistently call second output "branches"...
r37278 dest, branches = hg.parseurl(dest, None)[:2]
Pierre-Yves David
histedit: move outgoing processing to its own function...
r19021 ui.status(_('comparing with %s\n') % util.hidepassword(dest))
Martin von Zweigbergk
parseurl: consistently call second output "branches"...
r37278 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
Pierre-Yves David
histedit: move outgoing processing to its own function...
r19021 other = hg.peer(repo, opts, dest)
if revs:
revs = [repo.lookup(rev) for rev in revs]
outgoing = discovery.findcommonoutgoing(repo, other, revs, force=force)
if not outgoing.missing:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('no outgoing ancestors'))
FUJIWARA Katsunori
histedit: abort if there are multiple roots in "--outgoing" revisions...
r19841 roots = list(repo.revs("roots(%ln)", outgoing.missing))
if 1 < len(roots):
msg = _('there are ambiguous outgoing revisions')
timeless
histedit: use single quotes in use warning
r29970 hint = _("see 'hg help histedit' for more detail")
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(msg, hint=hint)
Martin von Zweigbergk
histedit: avoid repo.lookup() for converting revnum to nodeid...
r37330 return repo[roots[0]].node()
Pierre-Yves David
histedit: move outgoing processing to its own function...
r19021
Adrian Buehlmann
histedit: use cmdutil.command decorator
r17147 @command('histedit',
[('', 'commands', '',
Anton Shestakov
histedit: use better meta-variable names than VALUE in help text...
r24232 _('read history edits from the specified file'), _('FILE')),
Adrian Buehlmann
histedit: use cmdutil.command decorator
r17147 ('c', 'continue', False, _('continue an edit already in progress')),
Mateusz Kwapich
histedit: add --edit-plan option to histedit...
r24142 ('', 'edit-plan', False, _('edit remaining actions list')),
Adrian Buehlmann
histedit: use cmdutil.command decorator
r17147 ('k', 'keep', False,
_("don't strip old nodes after edit is complete")),
('', 'abort', False, _('abort an edit in progress')),
('o', 'outgoing', False, _('changesets not found in destination')),
('f', 'force', False,
_('force outgoing even for unrelated repositories')),
Pulkit Goyal
histedit: add support to output nodechanges using formatter...
r35124 ('r', 'rev', [], _('first revision to be edited'), _('REV'))] +
cmdutil.formatteropts,
timeless
histedit: clarify modes...
r27714 _("[OPTIONS] ([ANCESTOR] | --outgoing [URL])"))
Pierre-Yves David
histedit: move all arguments checks to the beginning of the command...
r19020 def histedit(ui, repo, *freeargs, **opts):
Augie Fackler
histedit: add extension docstring from external README...
r17131 """interactively edit changeset history
FUJIWARA Katsunori
histedit: add description about basic histedit function to command help...
r19621
timeless
histedit: explain basics of histedit commands...
r27713 This command lets you edit a linear series of changesets (up to
and including the working directory, which should be clean).
FUJIWARA Katsunori
doc: prevent non-literal text block from being treated as literal one...
r27956 You can:
timeless
histedit: explain basics of histedit commands...
r27713
- `pick` to [re]order a changeset
- `drop` to omit changeset
- `mess` to reword the changeset commit message
Ben Schmidt
histedit: improve documentation and behaviour of dates...
r31055 - `fold` to combine it with the preceding changeset (using the later date)
timeless
histedit: explain basics of histedit commands...
r27713
Ben Schmidt
histedit: modify rollup to discard date from the rollup commit (issue4820)...
r31056 - `roll` like fold, but discarding this commit's description and date
timeless
histedit: explain basics of histedit commands...
r27713
Ben Schmidt
histedit: improve documentation and behaviour of dates...
r31055 - `edit` to edit this changeset (preserving date)
FUJIWARA Katsunori
histedit: add description about "histedit --outgoing" to command help...
r19622
Saurabh Singh
histedit: removing the experimental config 'histeditng'...
r34490 - `base` to checkout changeset and apply further changesets from there
Wagner Bruna
histedit: fix typo in documentation
r27972 There are a number of ways to select the root changeset:
timeless
histedit: clarify modes...
r27714
- Specify ANCESTOR directly
Gregory Szorc
histedit: pick an appropriate base changeset by default (BC)...
r27262
timeless
histedit: clarify modes...
r27714 - Use --outgoing -- it will be the first linear changeset not
FUJIWARA Katsunori
doc: describe full help document hierarchy to create a valid link in HTML...
r28077 included in destination. (See :hg:`help config.paths.default-push`)
timeless
histedit: clarify modes...
r27714
- Otherwise, the value from the "histedit.defaultrev" config option
is used as a revset to select the base revision when ANCESTOR is not
specified. The first revision returned by the revset is used. By
default, this selects the editable history that is unique to the
ancestry of the working directory.
FUJIWARA Katsunori
histedit: add more detailed help about "--outgoing"
r19842
timeless
histedit: hide --outgoing warnings
r27630 .. container:: verbose
FUJIWARA Katsunori
histedit: add more detailed help about "--outgoing"
r19842
timeless
histedit: hide --outgoing warnings
r27630 If you use --outgoing, this command will abort if there are ambiguous
outgoing revisions. For example, if there are multiple branches
containing outgoing revisions.
Use "min(outgoing() and ::.)" or similar revset specification
instead of --outgoing to specify edit target revision exactly in
such ambiguous situation. See :hg:`help revsets` for detail about
selecting revisions.
FUJIWARA Katsunori
histedit: add description about exit code
r19972
Mathias De Maré
histedit: add examples
r27145 .. container:: verbose
Examples:
- A number of changes have been made.
Revision 3 is no longer needed.
Start history editing from revision 3::
hg histedit -r 3
An editor opens, containing the list of revisions,
with specific actions specified::
pick 5339bf82f0ca 3 Zworgle the foobar
pick 8ef592ce7cc4 4 Bedazzle the zerlog
pick 0a9639fcda9d 5 Morgify the cromulancy
Additional information about the possible actions
to take appears below the list of revisions.
To remove revision 3 from the history,
its action (at the beginning of the relevant line)
is changed to 'drop'::
drop 5339bf82f0ca 3 Zworgle the foobar
pick 8ef592ce7cc4 4 Bedazzle the zerlog
pick 0a9639fcda9d 5 Morgify the cromulancy
- A number of changes have been made.
Revision 2 and 4 need to be swapped.
Start history editing from revision 2::
hg histedit -r 2
An editor opens, containing the list of revisions,
with specific actions specified::
pick 252a1af424ad 2 Blorb a morgwazzle
pick 5339bf82f0ca 3 Zworgle the foobar
pick 8ef592ce7cc4 4 Bedazzle the zerlog
To swap revision 2 and 4, its lines are swapped
in the editor::
pick 8ef592ce7cc4 4 Bedazzle the zerlog
pick 5339bf82f0ca 3 Zworgle the foobar
pick 252a1af424ad 2 Blorb a morgwazzle
FUJIWARA Katsunori
histedit: add description about exit code
r19972 Returns 0 on success, 1 if user intervention is required (not only
for intentional "edit" command, but also for resolving unexpected
conflicts).
Augie Fackler
histedit: new extension for interactive history editing
r17064 """
David Soria Parra
histedit: move locks into state...
r22984 state = histeditstate(repo)
Siddharth Agarwal
histedit: hold wlock and lock while in progress...
r20071 try:
David Soria Parra
histedit: move locks into state...
r22984 state.wlock = repo.wlock()
state.lock = repo.lock()
_histedit(ui, repo, state, *freeargs, **opts)
Siddharth Agarwal
histedit: hold wlock and lock while in progress...
r20071 finally:
David Soria Parra
histedit: move locks into state...
r22984 release(state.lock, state.wlock)
Siddharth Agarwal
histedit: hold wlock and lock while in progress...
r20071
Kostia Balytskyi
histedit: change string literals to constants in goal naming...
r28144 goalcontinue = 'continue'
goalabort = 'abort'
goaleditplan = 'edit-plan'
goalnew = 'new'
Kostia Balytskyi
histedit: break _histedit function into smaller pieces...
r28134 def _getgoal(opts):
if opts.get('continue'):
Kostia Balytskyi
histedit: change string literals to constants in goal naming...
r28144 return goalcontinue
Kostia Balytskyi
histedit: break _histedit function into smaller pieces...
r28134 if opts.get('abort'):
Kostia Balytskyi
histedit: change string literals to constants in goal naming...
r28144 return goalabort
Kostia Balytskyi
histedit: break _histedit function into smaller pieces...
r28134 if opts.get('edit_plan'):
Kostia Balytskyi
histedit: change string literals to constants in goal naming...
r28144 return goaleditplan
return goalnew
Kostia Balytskyi
histedit: break _histedit function into smaller pieces...
r28134
Yuya Nishihara
histedit: use ui.fin to read commands from stdin...
r30262 def _readfile(ui, path):
Jun Wu
histedit: do not close stdin...
r28550 if path == '-':
Simon Farnsworth
histedit: log the time taken to read in the commands list...
r30983 with ui.timeblockedsection('histedit'):
return ui.fin.read()
Jun Wu
histedit: do not close stdin...
r28550 else:
with open(path, 'rb') as f:
return f.read()
Kostia Balytskyi
histedit: break _histedit function into smaller pieces...
r28134 def _validateargs(ui, repo, state, freeargs, opts, goal, rules, revs):
timeless
histedit: improve grammar for _histedit comment
r27169 # TODO only abort if we try to histedit mq patches, not just
Augie Fackler
histedit: new extension for interactive history editing
r17064 # blanket if mq patches are applied somewhere
mq = getattr(repo, 'mq', None)
if mq and mq.applied:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('source has mq patches applied'))
Augie Fackler
histedit: new extension for interactive history editing
r17064
Pierre-Yves David
histedit: move all arguments checks to the beginning of the command...
r19020 # basic argument incompatibility processing
outg = opts.get('outgoing')
Mateusz Kwapich
histedit: add --edit-plan option to histedit...
r24142 editplan = opts.get('edit_plan')
Pierre-Yves David
histedit: move all arguments checks to the beginning of the command...
r19020 abort = opts.get('abort')
force = opts.get('force')
if force and not outg:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('--force only allowed with --outgoing'))
Kostia Balytskyi
histedit: break _histedit function into smaller pieces...
r28134 if goal == 'continue':
Augie Fackler
cleanup: use __builtins__.any instead of util.any...
r25149 if any((outg, abort, revs, freeargs, rules, editplan)):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('no arguments allowed with --continue'))
Kostia Balytskyi
histedit: break _histedit function into smaller pieces...
r28134 elif goal == 'abort':
Augie Fackler
cleanup: use __builtins__.any instead of util.any...
r25149 if any((outg, revs, freeargs, rules, editplan)):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('no arguments allowed with --abort'))
Kostia Balytskyi
histedit: break _histedit function into smaller pieces...
r28134 elif goal == 'edit-plan':
Augie Fackler
cleanup: use __builtins__.any instead of util.any...
r25149 if any((outg, revs, freeargs)):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('only --commands argument allowed with '
Mateusz Kwapich
histedit: add --edit-plan option to histedit...
r24142 '--edit-plan'))
Pierre-Yves David
histedit: move all arguments checks to the beginning of the command...
r19020 else:
Martin von Zweigbergk
histedit: avoid repeating name of state file in a few places...
r38822 if state.inprogress():
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('history edit already in progress, try '
Pierre-Yves David
histedit: move all arguments checks to the beginning of the command...
r19020 '--continue or --abort'))
if outg:
if revs:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('no revisions allowed with --outgoing'))
Pierre-Yves David
histedit: move all arguments checks to the beginning of the command...
r19020 if len(freeargs) > 1:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(
Pierre-Yves David
histedit: move all arguments checks to the beginning of the command...
r19020 _('only one repo argument allowed with --outgoing'))
else:
Pierre-Yves David
histedit: move outgoing processing to its own function...
r19021 revs.extend(freeargs)
Durham Goode
histedit: allow configuring default behavior...
r24009 if len(revs) == 0:
Gregory Szorc
histedit: pick an appropriate base changeset by default (BC)...
r27262 defaultrev = destutil.desthistedit(ui, repo)
if defaultrev is not None:
revs.append(defaultrev)
Pierre-Yves David
histedit: move outgoing processing to its own function...
r19021 if len(revs) != 1:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(
FUJIWARA Katsunori
histedit: add description about basic histedit function to command help...
r19621 _('histedit requires exactly one ancestor revision'))
Pierre-Yves David
histedit: move all arguments checks to the beginning of the command...
r19020
Kostia Balytskyi
histedit: break _histedit function into smaller pieces...
r28134 def _histedit(ui, repo, state, *freeargs, **opts):
Pulkit Goyal
py3: handle keyword arguments in hgext/histedit.py...
r35000 opts = pycompat.byteskwargs(opts)
Pulkit Goyal
histedit: add support to output nodechanges using formatter...
r35124 fm = ui.formatter('histedit', opts)
fm.startitem()
Kostia Balytskyi
histedit: break _histedit function into smaller pieces...
r28134 goal = _getgoal(opts)
revs = opts.get('rev', [])
Sushil khanchi
histedit: add history-editing-backup config option...
r38756 # experimental config: ui.history-editing-backup
Sushil khanchi
histedit: drop --no-backup option...
r38761 nobackup = not ui.configbool('ui', 'history-editing-backup')
Kostia Balytskyi
histedit: break _histedit function into smaller pieces...
r28134 rules = opts.get('commands', '')
state.keep = opts.get('keep', False)
Augie Fackler
histedit: new extension for interactive history editing
r17064
Kostia Balytskyi
histedit: break _histedit function into smaller pieces...
r28134 _validateargs(ui, repo, state, freeargs, opts, goal, rules, revs)
David Soria Parra
histedit: use state object where necessary...
r22977
# rebuild state
Kostia Balytskyi
histedit: change string literals to constants in goal naming...
r28144 if goal == goalcontinue:
David Soria Parra
histedit: read state from histeditstate...
r22983 state.read()
David Soria Parra
histedit: pass state to boostrapcontinue...
r22980 state = bootstrapcontinue(ui, state, opts)
Kostia Balytskyi
histedit: change string literals to constants in goal naming...
r28144 elif goal == goaleditplan:
Kostia Balytskyi
histedit: renaming parts to which _histedit was split...
r28154 _edithisteditplan(ui, repo, state, rules)
Mateusz Kwapich
histedit: add --edit-plan option to histedit...
r24142 return
Kostia Balytskyi
histedit: change string literals to constants in goal naming...
r28144 elif goal == goalabort:
Sushil khanchi
histedit: add --no-backup option (issue5825)...
r38566 _aborthistedit(ui, repo, state, nobackup=nobackup)
Augie Fackler
histedit: new extension for interactive history editing
r17064 return
else:
Kostia Balytskyi
histedit: change string literals to constants in goal naming...
r28144 # goal == goalnew
Kostia Balytskyi
histedit: renaming parts to which _histedit was split...
r28154 _newhistedit(ui, repo, state, revs, freeargs, opts)
Durham Goode
histedit: store backup file before histedit...
r24757
Kostia Balytskyi
histedit: renaming parts to which _histedit was split...
r28154 _continuehistedit(ui, repo, state)
Pulkit Goyal
histedit: add support to output nodechanges using formatter...
r35124 _finishhistedit(ui, repo, state, fm)
fm.end()
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _continueaction)...
r28133
Kostia Balytskyi
histedit: renaming parts to which _histedit was split...
r28154 def _continuehistedit(ui, repo, state):
"""This function runs after either:
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _continueaction)...
r28133 - bootstrapcontinue (if the goal is 'continue')
Kostia Balytskyi
histedit: renaming parts to which _histedit was split...
r28154 - _newhistedit (if the goal is 'new')
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _continueaction)...
r28133 """
Augie Fackler
histedit: use one editor when multiple folds happen in a row (issue3524) (BC)...
r26246 # preprocess rules so that we can hide inner folds from the user
# and only show one editor
Mateusz Kwapich
histedit: change state.rules uses to state.actions...
r27207 actions = state.actions[:]
for idx, (action, nextact) in enumerate(
zip(actions, actions[1:] + [None])):
if action.verb == 'fold' and nextact and nextact.verb == 'fold':
state.actions[idx].__class__ = _multifold
Augie Fackler
histedit: use one editor when multiple folds happen in a row (issue3524) (BC)...
r26246
Durham Goode
histedit: add histedit.singletransaction config option...
r31513 # Force an initial state file write, so the user can run --abort/continue
# even if there's an exception before the first transaction serialize.
state.write()
Martin von Zweigbergk
histedit: create transaction outside of try...
r33445
tr = None
# Don't use singletransaction by default since it rolls the entire
# transaction back if an unexpected exception happens (like a
# pretxncommit hook throws, or the user aborts the commit msg editor).
Boris Feld
configitems: register the 'histedit.singletransaction' config
r34475 if ui.configbool("histedit", "singletransaction"):
Martin von Zweigbergk
histedit: create transaction outside of try...
r33445 # Don't use a 'with' for the transaction, since actions may close
# and reopen a transaction. For example, if the action executes an
# external process it may choose to commit the transaction first.
tr = repo.transaction('histedit')
Martin von Zweigbergk
histedit: use progress helper...
r38397 progress = ui.makeprogress(_("editing"), unit=_('changes'),
total=len(state.actions))
with progress, util.acceptintervention(tr):
Durham Goode
histedit: add histedit.singletransaction config option...
r31513 while state.actions:
Martin von Zweigbergk
histedit: remove transaction from state object...
r33444 state.write(tr=tr)
Durham Goode
histedit: add histedit.singletransaction config option...
r31513 actobj = state.actions[0]
Martin von Zweigbergk
histedit: use progress helper...
r38397 progress.increment(item=actobj.torule())
Durham Goode
histedit: add histedit.singletransaction config option...
r31513 ui.debug('histedit: processing %s %s\n' % (actobj.verb,\
actobj.torule()))
parentctx, replacement_ = actobj.run()
state.parentctxnode = parentctx.node()
state.replacements.extend(replacement_)
state.actions.pop(0)
Mateusz Kwapich
histedit: don't allow to strip nodes which are necessary to continue histedit...
r24111 state.write()
Augie Fackler
histedit: new extension for interactive history editing
r17064
Pulkit Goyal
histedit: add support to output nodechanges using formatter...
r35124 def _finishhistedit(ui, repo, state, fm):
Kostia Balytskyi
histedit: break _histedit into smaller pieces (add _finishaction)...
r28153 """This action runs when histedit is finishing its session"""
Yuya Nishihara
cleanup: pass in overwrite flag to hg.updaterepo() as named argument...
r38527 hg.updaterepo(repo, state.parentctxnode, overwrite=False)
Augie Fackler
histedit: new extension for interactive history editing
r17064
Augie Fackler
histedit: remove now-superfluous repo argument from processreplacement...
r22985 mapping, tmpnodes, created, ntm = processreplacement(state)
Pierre-Yves David
histedit: replace various nodes lists with replacement graph (and issue3582)...
r17758 if mapping:
for prec, succs in mapping.iteritems():
if not succs:
ui.debug('histedit: %s is dropped\n' % node.short(prec))
else:
ui.debug('histedit: %s is replaced by %s\n' % (
node.short(prec), node.short(succs[0])))
if len(succs) > 1:
m = 'histedit: %s'
for n in succs[1:]:
ui.debug(m % node.short(n))
Durham Goode
histedit: fix keep during --continue...
r25330 if not state.keep:
Pierre-Yves David
histedit: replace various nodes lists with replacement graph (and issue3582)...
r17758 if mapping:
Jun Wu
histedit: use scmutil.cleanupnodes (BC)...
r33351 movetopmostbookmarks(repo, state.topmost, ntm)
Pierre-Yves David
histedit: extract bookmark logic in a dedicated function...
r17663 # TODO update mq state
Jun Wu
histedit: unify strip backup files on success (BC)...
r33350 else:
mapping = {}
for n in tmpnodes:
mapping[n] = ()
Jun Wu
histedit: use scmutil.cleanupnodes (BC)...
r33351 # remove entries about unknown nodes
nodemap = repo.unfiltered().changelog.nodemap
mapping = {k: v for k, v in mapping.items()
if k in nodemap and all(n in nodemap for n in v)}
scmutil.cleanupnodes(repo, mapping, 'histedit')
Pulkit Goyal
histedit: add support to output nodechanges using formatter...
r35124 hf = fm.hexfunc
fl = fm.formatlist
fd = fm.formatdict
nodechanges = fd({hf(oldn): fl([hf(n) for n in newn], name='node')
for oldn, newn in mapping.iteritems()},
key="oldnode", value="newnodes")
fm.data(nodechanges=nodechanges)
Pierre-Yves David
histedit: backout ebb5bb9bc32e...
r25894
David Soria Parra
histedit: add clear method to remove state...
r22978 state.clear()
Augie Fackler
histedit: new extension for interactive history editing
r17064 if os.path.exists(repo.sjoin('undo')):
os.unlink(repo.sjoin('undo'))
timeless
histedit: limit cleanup of histedit-last-edit.txt to success
r27546 if repo.vfs.exists('histedit-last-edit.txt'):
repo.vfs.unlink('histedit-last-edit.txt')
Augie Fackler
histedit: new extension for interactive history editing
r17064
Sushil khanchi
histedit: add --no-backup option (issue5825)...
r38566 def _aborthistedit(ui, repo, state, nobackup=False):
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _abortaction)...
r28130 try:
state.read()
Kostia Balytskyi
histedit: unifying the way replacements are computed for abort and success...
r28179 __, leafs, tmpnodes, __ = processreplacement(state)
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _abortaction)...
r28130 ui.debug('restore wc to old parent %s\n'
% node.short(state.topmost))
# Recover our old commits if necessary
if not state.topmost in repo and state.backupfile:
Pierre-Yves David
histedit: directly use repo.vfs.join...
r31329 backupfile = repo.vfs.join(state.backupfile)
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _abortaction)...
r28130 f = hg.openpath(ui, backupfile)
gen = exchange.readbundle(ui, f, backupfile)
with repo.transaction('histedit.abort') as tr:
Martin von Zweigbergk
bundle: make applybundle() delegate v1 bundles to applybundle1()
r33043 bundle2.applybundle(repo, gen, tr, source='histedit',
url='bundle:' + backupfile)
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _abortaction)...
r28130
os.remove(backupfile)
# check whether we should update away
if repo.unfiltered().revs('parents() and (%n or %ln::)',
state.parentctxnode, leafs | tmpnodes):
hg.clean(repo, state.topmost, show_stats=True, quietempty=True)
Sushil khanchi
histedit: add --no-backup option (issue5825)...
r38566 cleanupnode(ui, repo, tmpnodes, nobackup=nobackup)
cleanupnode(ui, repo, leafs, nobackup=nobackup)
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _abortaction)...
r28130 except Exception:
if state.inprogress():
ui.warn(_('warning: encountered an exception during histedit '
'--abort; the repository may not have been completely '
'cleaned up\n'))
raise
finally:
state.clear()
Kostia Balytskyi
histedit: renaming parts to which _histedit was split...
r28154 def _edithisteditplan(ui, repo, state, rules):
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _editplanaction)...
r28131 state.read()
if not rules:
Mateusz Kwapich
histedit: add a hint about enabled dropmissing to histedit edit comment...
r28592 comment = geteditcomment(ui,
node.short(state.parentctxnode),
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _editplanaction)...
r28131 node.short(state.topmost))
rules = ruleeditor(repo, ui, state.actions, comment)
else:
Yuya Nishihara
histedit: use ui.fin to read commands from stdin...
r30262 rules = _readfile(ui, rules)
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _editplanaction)...
r28131 actions = parserules(rules, state)
Pierre-Yves David
histedit: drop the 'nodetoverify' method...
r29874 ctxs = [repo[act.node] \
for act in state.actions if act.node]
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _editplanaction)...
r28131 warnverifyactions(ui, repo, actions, state, ctxs)
state.actions = actions
state.write()
Kostia Balytskyi
histedit: renaming parts to which _histedit was split...
r28154 def _newhistedit(ui, repo, state, revs, freeargs, opts):
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _newaction)...
r28132 outg = opts.get('outgoing')
rules = opts.get('commands', '')
force = opts.get('force')
cmdutil.checkunfinished(repo)
cmdutil.bailifchanged(repo)
topmost, empty = repo.dirstate.parents()
if outg:
if freeargs:
remote = freeargs[0]
else:
remote = None
root = findoutgoing(ui, repo, remote, force, opts)
else:
rr = list(repo.set('roots(%ld)', scmutil.revrange(repo, revs)))
if len(rr) != 1:
raise error.Abort(_('The specified revisions must have '
'exactly one common root'))
root = rr[0].node()
revs = between(repo, root, topmost, state.keep)
if not revs:
raise error.Abort(_('%s is not an ancestor of working directory') %
node.short(root))
ctxs = [repo[r] for r in revs]
if not rules:
Mateusz Kwapich
histedit: add a hint about enabled dropmissing to histedit edit comment...
r28592 comment = geteditcomment(ui, node.short(root), node.short(topmost))
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _newaction)...
r28132 actions = [pick(state, r) for r in revs]
rules = ruleeditor(repo, ui, actions, comment)
else:
Yuya Nishihara
histedit: use ui.fin to read commands from stdin...
r30262 rules = _readfile(ui, rules)
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _newaction)...
r28132 actions = parserules(rules, state)
warnverifyactions(ui, repo, actions, state, ctxs)
parentctxnode = repo[root].parents()[0].node()
state.parentctxnode = parentctxnode
state.actions = actions
state.topmost = topmost
state.replacements = []
Phil Cohen
histedit: add ui.log for action count...
r35506 ui.log("histedit", "%d actions to histedit", len(actions),
histedit_num_actions=len(actions))
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _newaction)...
r28132 # Create a backup so we can always abort completely.
backupfile = None
if not obsolete.isenabled(repo, obsolete.createmarkersopt):
Gregory Szorc
repair: rename _backup to backupbundle...
r37034 backupfile = repair.backupbundle(repo, [parentctxnode],
[topmost], root, 'histedit')
Kostia Balytskyi
histedit: break _histedit function into smaller pieces (add _newaction)...
r28132 state.backupfile = backupfile
Sean Farley
histedit: extract common summary code into method...
r29467 def _getsummary(ctx):
# a common pattern is to extract the summary but default to the empty
# string
summary = ctx.description() or ''
if summary:
summary = summary.splitlines()[0]
return summary
Durham Goode
histedit: delete all non-actionclass related code...
r24774 def bootstrapcontinue(ui, state, opts):
repo = state.repo
Siddharth Agarwal
histedit: make check for unresolved conflicts explicit (issue5545)...
r32057
ms = mergemod.mergestate.read(repo)
mergeutil.checkunresolved(ms)
Mateusz Kwapich
histedit: change state.rules uses to state.actions...
r27207 if state.actions:
actobj = state.actions.pop(0)
Durham Goode
histedit: fix --continue when rules are finished...
r24959
liscju
histedit: extracts _isdirtywc function...
r26981 if _isdirtywc(repo):
Durham Goode
histedit: fix --continue when rules are finished...
r24959 actobj.continuedirty()
liscju
histedit: extracts _isdirtywc function...
r26981 if _isdirtywc(repo):
Mateusz Kwapich
histedit: add abortdirty function...
r27084 abortdirty()
Durham Goode
histedit: integrate action class into flow...
r24766
Durham Goode
histedit: fix --continue when rules are finished...
r24959 parentctx, replacements = actobj.continueclean()
Pierre-Yves David
histedit: move `continue` logic into a dedicated function...
r17666
Durham Goode
histedit: fix --continue when rules are finished...
r24959 state.parentctxnode = parentctx.node()
state.replacements.extend(replacements)
David Soria Parra
histedit: pass state to boostrapcontinue...
r22980
return state
Pierre-Yves David
histedit: move `continue` logic into a dedicated function...
r17666
Pierre-Yves David
histedit: move `between function` outside the action logic...
r17642 def between(repo, old, new, keep):
"""select and validate the set of revision to edit
When keep is false, the specified set can't have children."""
Yuya Nishihara
histedit: use repo.revs() instead of repo.set() where revisions are needed...
r36431 revs = repo.revs('%n::%n', old, new)
if revs and not keep:
Durham Goode
obsolete: add allowunstable option...
r22952 if (not obsolete.isenabled(repo, obsolete.allowunstableopt) and
Gregory Szorc
histedit: resolve revs before evaluating %ld revset...
r36427 repo.revs('(%ld::) - (%ld)', revs, revs)):
liscju
histedit: improve error when run on nodes with children (issue5056)
r28294 raise error.Abort(_('can only histedit a changeset together '
'with all its descendants'))
Gregory Szorc
histedit: resolve revs before evaluating %ld revset...
r36427 if repo.revs('(%ld) and merge()', revs):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot edit history that contains merges'))
Yuya Nishihara
histedit: use repo.revs() instead of repo.set() where revisions are needed...
r36431 root = repo[revs.first()] # list is already sorted by repo.revs()
Augie Fackler
histedit: check mutability of contexts correctly...
r22416 if not root.mutable():
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot edit public changeset: %s') % root,
timeless
histedit: use single quotes in use warning
r29970 hint=_("see 'hg help phases' for details"))
Yuya Nishihara
histedit: use repo.revs() instead of repo.set() where revisions are needed...
r36431 return pycompat.maplist(repo.changelog.node, revs)
Pierre-Yves David
histedit: move `between function` outside the action logic...
r17642
Mateusz Kwapich
histedit: use torule instead of makedesc in ruleeditor
r27204 def ruleeditor(repo, ui, actions, editcomment=""):
Mateusz Kwapich
histedit: extract method ruleeditor...
r24140 """open an editor to edit rules
rules are in the format [ [act, ctx], ...] like in state.rules
"""
Sean Farley
histedit: move autoverb logic from torule to ruleeditor...
r29465 if repo.ui.configbool("experimental", "histedit.autoverb"):
Sean Farley
histedit: move autoverb rule to the commit it matches...
r29470 newact = util.sortdict()
Sean Farley
histedit: move autoverb logic from torule to ruleeditor...
r29465 for act in actions:
ctx = repo[act.node]
Sean Farley
histedit: use _getsummary in ruleeditor...
r29469 summary = _getsummary(ctx)
Sean Farley
histedit: move autoverb logic from torule to ruleeditor...
r29465 fword = summary.split(' ', 1)[0].lower()
Sean Farley
histedit: move autoverb rule to the commit it matches...
r29470 added = False
Sean Farley
histedit: move autoverb logic from torule to ruleeditor...
r29465 # if it doesn't end with the special character '!' just skip this
if fword.endswith('!'):
fword = fword[:-1]
if fword in primaryactions | secondaryactions | tertiaryactions:
act.verb = fword
Sean Farley
histedit: move autoverb rule to the commit it matches...
r29470 # get the target summary
tsum = summary[len(fword) + 1:].lstrip()
# safe but slow: reverse iterate over the actions so we
# don't clash on two commits having the same summary
for na, l in reversed(list(newact.iteritems())):
actx = repo[na.node]
asum = _getsummary(actx)
if asum == tsum:
added = True
l.append(act)
break
if not added:
newact[act] = []
# copy over and flatten the new list
actions = []
for na, l in newact.iteritems():
actions.append(na)
actions += l
Sean Farley
histedit: move autoverb logic from torule to ruleeditor...
r29465
Sean Farley
histedit: remove unneeded initial parameter...
r29466 rules = '\n'.join([act.torule() for act in actions])
Mateusz Kwapich
histedit: extract method ruleeditor...
r24140 rules += '\n\n'
rules += editcomment
Sean Farley
histedit: add tmpdir parameter to ui.edit call
r30837 rules = ui.edit(rules, ui.username(), {'prefix': 'histedit'},
Michael Bolin
editor: use an unambiguous path suffix for editor files...
r34030 repopath=repo.path, action='histedit')
Mateusz Kwapich
histedit: extract method ruleeditor...
r24140
# Save edit rules in .hg/histedit-last-edit.txt in case
# the user needs to ask for help after something
# surprising happens.
Augie Fackler
histedit: modernize write of histedit-last-edit file...
r36186 with repo.vfs('histedit-last-edit.txt', 'wb') as f:
f.write(rules)
Mateusz Kwapich
histedit: extract method ruleeditor...
r24140
return rules
Mateusz Kwapich
histedit: get rid of state.rules...
r27208 def parserules(rules, state):
"""Read the histedit rules string and return list of action objects """
rules = [l for l in (r.strip() for r in rules.splitlines())
if l and not l.startswith('#')]
actions = []
Augie Fackler
histedit: new extension for interactive history editing
r17064 for r in rules:
if ' ' not in r:
timeless
histedit: use parse-error exception for parsing
r27545 raise error.ParseError(_('malformed line "%s"') % r)
Mateusz Kwapich
histedit: make verification configurable...
r27082 verb, rest = r.split(' ', 1)
Mateusz Kwapich
histedit: get rid of state.rules...
r27208 if verb not in actiontable:
timeless
histedit: use parse-error exception for parsing
r27545 raise error.ParseError(_('unknown action "%s"') % verb)
Mateusz Kwapich
histedit: get rid of state.rules...
r27208
Mateusz Kwapich
histedit: make verification configurable...
r27082 action = actiontable[verb].fromrule(state, rest)
Mateusz Kwapich
histedit: get rid of state.rules...
r27208 actions.append(action)
return actions
timeless
histedit: limit mentioning histedit-last-edit.txt...
r27543 def warnverifyactions(ui, repo, actions, state, ctxs):
try:
verifyactions(actions, state, ctxs)
timeless
histedit: use parse-error exception for parsing
r27545 except error.ParseError:
timeless
histedit: limit mentioning histedit-last-edit.txt...
r27543 if repo.vfs.exists('histedit-last-edit.txt'):
ui.warn(_('warning: histedit rules saved '
'to: .hg/histedit-last-edit.txt\n'))
raise
Mateusz Kwapich
histedit: get rid of state.rules...
r27208 def verifyactions(actions, state, ctxs):
"""Verify that there exists exactly one action per given changeset and
other constraints.
Will abort if there are to many or too few rules, a malformed rule,
or a rule on a changeset outside of the user-given range.
"""
Pierre-Yves David
histedit: directly use node in 'verifyactions'...
r29878 expected = set(c.node() for c in ctxs)
Mateusz Kwapich
histedit: get rid of state.rules...
r27208 seen = set()
timeless
histedit: pass previous action to verify
r27541 prev = None
André Klitzing
histedit: check first changeset for verb "roll" or "fold" (issue5498)...
r33757
if actions and actions[0].verb in ['roll', 'fold']:
raise error.ParseError(_('first changeset cannot use verb "%s"') %
actions[0].verb)
Mateusz Kwapich
histedit: get rid of state.rules...
r27208 for action in actions:
Pierre-Yves David
histedit: move constraint verification to the 'action.verify' method...
r29879 action.verify(prev, expected, seen)
timeless
histedit: pass previous action to verify
r27541 prev = action
Pierre-Yves David
histedit: drop the 'nodetoverify' local variable...
r29876 if action.node is not None:
Pierre-Yves David
histedit: directly use node in 'verifyactions'...
r29878 seen.add(action.node)
Pierre-Yves David
histedit: more precise user message when changeset is missing...
r19048 missing = sorted(expected - seen) # sort to stabilize output
Mateusz Kwapich
histedit: delete to drop...
r27414
if state.repo.ui.configbool('histedit', 'dropmissing'):
Mateusz Kwapich
histedit: have dropmissing abort on empty plan...
r28519 if len(actions) == 0:
raise error.ParseError(_('no rules provided'),
hint=_('use strip extension to remove commits'))
Pierre-Yves David
histedit: directly use node in 'verifyactions'...
r29878 drops = [drop(state, n) for n in missing]
Mateusz Kwapich
histedit: delete to drop...
r27414 # put the in the beginning so they execute immediately and
# don't show in the edit-plan in the future
actions[:0] = drops
elif missing:
timeless
histedit: use parse-error exception for parsing
r27545 raise error.ParseError(_('missing rules for changeset %s') %
Pierre-Yves David
histedit: directly use node in 'verifyactions'...
r29878 node.short(missing[0]),
Mateusz Kwapich
histedit: delete to drop...
r27414 hint=_('use "drop %s" to discard, see also: '
timeless
histedit: use single quotes in use warning
r29970 "'hg help -e histedit.config'")
Pierre-Yves David
histedit: directly use node in 'verifyactions'...
r29878 % node.short(missing[0]))
Pierre-Yves David
histedit: extract bookmark logic in a dedicated function...
r17663
Kostia Balytskyi
histedit: make histedit aware of obsolescense not stored in state (issue4800)...
r28216 def adjustreplacementsfrommarkers(repo, oldreplacements):
Mads Kiilerich
spelling: fixes of non-dictionary words
r30332 """Adjust replacements from obsolescence markers
Kostia Balytskyi
histedit: make histedit aware of obsolescense not stored in state (issue4800)...
r28216
Replacements structure is originally generated based on
histedit's state and does not account for changes that are
not recorded there. This function fixes that by adding
Mads Kiilerich
spelling: fixes of non-dictionary words
r30332 data read from obsolescence markers"""
Kostia Balytskyi
histedit: make histedit aware of obsolescense not stored in state (issue4800)...
r28216 if not obsolete.isenabled(repo, obsolete.createmarkersopt):
return oldreplacements
unfi = repo.unfiltered()
Pierre-Yves David
histedit: also handle locally missing nodes when reading obsolescence...
r28224 nm = unfi.changelog.nodemap
obsstore = repo.obsstore
Kostia Balytskyi
histedit: make histedit aware of obsolescense not stored in state (issue4800)...
r28216 newreplacements = list(oldreplacements)
oldsuccs = [r[1] for r in oldreplacements]
# successors that have already been added to succstocheck once
seensuccs = set().union(*oldsuccs) # create a set from an iterable of tuples
succstocheck = list(seensuccs)
while succstocheck:
n = succstocheck.pop()
Pierre-Yves David
histedit: also handle locally missing nodes when reading obsolescence...
r28224 missing = nm.get(n) is None
markers = obsstore.successors.get(n, ())
if missing and not markers:
# dead end, mark it as such
Kostia Balytskyi
histedit: make histedit aware of obsolescense not stored in state (issue4800)...
r28216 newreplacements.append((n, ()))
Pierre-Yves David
histedit: also handle locally missing nodes when reading obsolescence...
r28224 for marker in markers:
nsuccs = marker[1]
Kostia Balytskyi
histedit: make histedit aware of obsolescense not stored in state (issue4800)...
r28216 newreplacements.append((n, nsuccs))
for nsucc in nsuccs:
if nsucc not in seensuccs:
seensuccs.add(nsucc)
succstocheck.append(nsucc)
return newreplacements
Augie Fackler
histedit: remove now-superfluous repo argument from processreplacement...
r22985 def processreplacement(state):
Pierre-Yves David
histedit: replace various nodes lists with replacement graph (and issue3582)...
r17758 """process the list of replacements to return
1) the final mapping between original and created nodes
2) the list of temporary node created by histedit
3) the list of new commit created by histedit"""
Kostia Balytskyi
histedit: make histedit aware of obsolescense not stored in state (issue4800)...
r28216 replacements = adjustreplacementsfrommarkers(state.repo, state.replacements)
Pierre-Yves David
histedit: replace various nodes lists with replacement graph (and issue3582)...
r17758 allsuccs = set()
replaced = set()
fullmapping = {}
Augie Fackler
histedit: correct spelling etc in more comments...
r26039 # initialize basic set
# fullmapping records all operations recorded in replacement
Pierre-Yves David
histedit: replace various nodes lists with replacement graph (and issue3582)...
r17758 for rep in replacements:
allsuccs.update(rep[1])
replaced.add(rep[0])
fullmapping.setdefault(rep[0], set()).update(rep[1])
new = allsuccs - replaced
tmpnodes = allsuccs & replaced
Augie Fackler
histedit: correct spelling etc in more comments...
r26039 # Reduce content fullmapping into direct relation between original nodes
Pierre-Yves David
histedit: replace various nodes lists with replacement graph (and issue3582)...
r17758 # and final node created during history edition
# Dropped changeset are replaced by an empty list
toproceed = set(fullmapping)
final = {}
while toproceed:
for x in list(toproceed):
succs = fullmapping[x]
for s in list(succs):
if s in toproceed:
# non final node with unknown closure
# We can't process this now
break
elif s in final:
# non final node, replace with closure
succs.remove(s)
succs.update(final[s])
else:
final[x] = succs
toproceed.remove(x)
# remove tmpnodes from final mapping
for n in tmpnodes:
del final[n]
# we expect all changes involved in final to exist in the repo
# turn `final` into list (topologically sorted)
Augie Fackler
histedit: remove now-superfluous repo argument from processreplacement...
r22985 nm = state.repo.changelog.nodemap
Pierre-Yves David
histedit: replace various nodes lists with replacement graph (and issue3582)...
r17758 for prec, succs in final.items():
final[prec] = sorted(succs, key=nm.get)
Pierre-Yves David
histedit: extract bookmark logic in a dedicated function...
r17663
Pierre-Yves David
histedit: replace various nodes lists with replacement graph (and issue3582)...
r17758 # computed topmost element (necessary for bookmark)
if new:
Augie Fackler
histedit: remove now-superfluous repo argument from processreplacement...
r22985 newtopmost = sorted(new, key=state.repo.changelog.rev)[-1]
Pierre-Yves David
histedit: replace various nodes lists with replacement graph (and issue3582)...
r17758 elif not final:
# Nothing rewritten at all. we won't need `newtopmost`
# It is the same as `oldtopmost` and `processreplacement` know it
newtopmost = None
else:
# every body died. The newtopmost is the parent of the root.
Augie Fackler
histedit: remove now-superfluous repo argument from processreplacement...
r22985 r = state.repo.changelog.rev
newtopmost = state.repo[sorted(final, key=r)[0]].p1().node()
Pierre-Yves David
histedit: replace various nodes lists with replacement graph (and issue3582)...
r17758
return final, tmpnodes, new, newtopmost
Pierre-Yves David
histedit: extract bookmark logic in a dedicated function...
r17663
Jun Wu
histedit: move topmost bookmark movement to a separate function...
r33346 def movetopmostbookmarks(repo, oldtopmost, newtopmost):
"""Move bookmark from oldtopmost to newly created topmost
This is arguably a feature and we may only want that for the active
bookmark. But the behavior is kept compatible with the old version for now.
"""
if not oldtopmost or not newtopmost:
return
oldbmarks = repo.nodebookmarks(oldtopmost)
if oldbmarks:
with repo.lock(), repo.transaction('histedit') as tr:
marks = repo._bookmarks
Boris Feld
bookmark: use 'applychanges' when updating bookmark in histedit
r33486 changes = []
Jun Wu
histedit: move topmost bookmark movement to a separate function...
r33346 for name in oldbmarks:
Boris Feld
bookmark: use 'applychanges' when updating bookmark in histedit
r33486 changes.append((name, newtopmost))
marks.applychanges(repo, tr, changes)
Jun Wu
histedit: move topmost bookmark movement to a separate function...
r33346
Sushil khanchi
histedit: add --no-backup option (issue5825)...
r38566 def cleanupnode(ui, repo, nodes, nobackup=False):
Pierre-Yves David
histedit: backout changeset 2b599f5468a4...
r31637 """strip a group of nodes from the repository
The set of node to strip may contains unknown nodes."""
with repo.lock():
# do not let filtering get in the way of the cleanse
# we should probably get rid of obsolescence marker created during the
# histedit, but we currently do not have such information.
repo = repo.unfiltered()
# Find all nodes that need to be stripped
# (we use %lr instead of %ln to silently ignore unknown items)
nm = repo.changelog.nodemap
nodes = sorted(n for n in nodes if n in nm)
roots = [c.node() for c in repo.set("roots(%ln)", nodes)]
Jun Wu
histedit: pass multiple nodes to strip (BC)...
r33349 if roots:
Sushil khanchi
histedit: add --no-backup option (issue5825)...
r38566 backup = not nobackup
repair.strip(ui, repo, roots, backup=backup)
Pierre-Yves David
histedit: backout changeset 2b599f5468a4...
r31637
Mateusz Kwapich
histedit: don't allow to strip nodes which are necessary to continue histedit...
r24111 def stripwrapper(orig, ui, repo, nodelist, *args, **kwargs):
if isinstance(nodelist, str):
nodelist = [nodelist]
Martin von Zweigbergk
histedit: avoid repeating name of state file in a few places...
r38822 state = histeditstate(repo)
if state.inprogress():
Mateusz Kwapich
histedit: don't allow to strip nodes which are necessary to continue histedit...
r24111 state.read()
Martin von Zweigbergk
cleanup: use set literals...
r32291 histedit_nodes = {action.node for action
in state.actions if action.node}
Martin von Zweigbergk
histedit: avoid converting nodeid to context and back again...
r30025 common_nodes = histedit_nodes & set(nodelist)
Mateusz Kwapich
histedit: don't allow to strip nodes which are necessary to continue histedit...
r24111 if common_nodes:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("histedit in progress, can't strip %s")
Matt Mackall
histedit: fix style of new error message...
r24196 % ', '.join(node.short(x) for x in common_nodes))
Mateusz Kwapich
histedit: don't allow to strip nodes which are necessary to continue histedit...
r24111 return orig(ui, repo, nodelist, *args, **kwargs)
extensions.wrapfunction(repair, 'strip', stripwrapper)
Bryan O'Sullivan
summary: add a histedit hook
r19215 def summaryhook(ui, repo):
Martin von Zweigbergk
histedit: avoid repeating name of state file in a few places...
r38822 state = histeditstate(repo)
if not state.inprogress():
Bryan O'Sullivan
summary: add a histedit hook
r19215 return
David Soria Parra
histedit: read state from histeditstate...
r22983 state.read()
Mateusz Kwapich
histedit: change state.rules uses to state.actions...
r27207 if state.actions:
Bryan O'Sullivan
summary: add a histedit hook
r19215 # i18n: column positioning for "hg summary"
ui.write(_('hist: %s (histedit --continue)\n') %
(ui.label(_('%d remaining'), 'histedit.remaining') %
Mateusz Kwapich
histedit: change state.rules uses to state.actions...
r27207 len(state.actions)))
Bryan O'Sullivan
summary: add a histedit hook
r19215
def extsetup(ui):
cmdutil.summaryhooks.add('histedit', summaryhook)
Matt Mackall
histedit: add checkunfinished support (issue3955)...
r19479 cmdutil.unfinishedstates.append(
Matt Mackall
checkunfinished: accommodate histedit quirk...
r19496 ['histedit-state', False, True, _('histedit in progress'),
Matt Mackall
histedit: add checkunfinished support (issue3955)...
r19479 _("use 'hg histedit --continue' or 'hg histedit --abort'")])
timeless
histedit: hook afterresolvedstates
r27627 cmdutil.afterresolvedstates.append(
['histedit-state', _('hg histedit --continue')])