Mercurial > hg
view mercurial/templates/monoblue/map @ 41987:c1d83d916e85
revert: option to choose what to keep, not what to discard
I know the you (the reader) are probably tired of discussing how `hg
revert -i -r .` should behave and so am I. And I know I'm one of the
people who argued that showing the diff from the working copy to the
parent was confusing. I think it is less confusing now that we show
the diff from the parent to the working copy, but I still find it
confusing. I think showing the diff of hunks to keep might make it
easier to understand. So that's what this patch provides an option
for.
One argument doing it this way is that most people seem to find `hg
split` natural. I suspect that is because it shows the forward diff
(from parent commit to the commit) and asks you what to put in the
first commit. I think the new "keep" mode for revert (this patch)
matches that.
In "keep" mode, all the changes are still selected by default. That
means that `hg revert -i` followed by 'A' (keep all) (or 'c' in
curses) will be different from `hg revert -a`. That's mostly because
that was simplest. It can also be argued that it's safest. But it can
also be argued that it should be consistent with `hg revert -a`.
Note that in this mode, you can edit the hunks and it will do what you
expect (e.g. add new lines to your file if you added a new lines when
editing). The test case shows that that works.
Differential Revision: https://phab.mercurial-scm.org/D6125
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 12 Mar 2019 14:17:41 -0700 |
parents | 9ed3527019b5 |
children |
line wrap: on
line source
default = 'summary' mimetype = 'text/html; charset={encoding}' header = header.tmpl footer = footer.tmpl search = search.tmpl changelog = changelog.tmpl summary = summary.tmpl error = error.tmpl notfound = notfound.tmpl help = help.tmpl helptopics = helptopics.tmpl helpentry = ' <tr><td> <a href="{url|urlescape}help/{topic|escape}{sessionvars%urlparameter}"> {if(basename, '{basename|escape}', '{topic|escape}')} </a> </td><td> {summary|escape} </td></tr>' naventry = '<a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> ' navshortentry = '<a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> ' navgraphentry = '<a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">{label|escape}</a> ' filenaventry = '<a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> ' filedifflink = '<a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{file|escape}</a> ' filenodelink = ' <tr class="parity{parity}"> <td><a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{file|escape}</a></td> <td></td> <td> <a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a> | <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a> | <a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> | <a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a> | <a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> </td> </tr>' filenolink = ' <tr class="parity{parity}"> <td><a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{file|escape}</a></td> <td></td> <td> file | annotate | <a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> | <a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a> | <a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> </td> </tr>' nav = '{before%naventry} {after%naventry}' navshort = '{before%navshortentry}{after%navshortentry}' navgraph = '{before%navgraphentry}{after%navgraphentry}' filenav = '{before%filenaventry}{after%filenaventry}' fileellipses = '...' changelogentry = changelogentry.tmpl changeset = changeset.tmpl manifest = manifest.tmpl updirentry = ' <tr class="parity{upparity}"> <td>drwxr-xr-x</td> <td></td> <td></td> <td> <a href="{url|urlescape}file/{symrev}{up|urlescape}{sessionvars%urlparameter}">[up]</a> </td> <td class="link"> </td> </tr>' direntry = ' <tr class="parity{parity}"> <td>drwxr-xr-x</td> <td></td> <td></td> <td> <a href="{url|urlescape}file/{symrev}{path|urlescape}{sessionvars%urlparameter}">{basename|escape}</a> <a href="{url|urlescape}file/{symrev}{path|urlescape}/{emptydirs|urlescape}{sessionvars%urlparameter}">{emptydirs|escape}</a> </td> <td><a href="{url|urlescape}file/{symrev}{path|urlescape}{sessionvars%urlparameter}">files</a></td> </tr>' fileentry = ' <tr class="parity{parity}"> <td>{permissions|permissions}</td> <td>{date|isodate}</td> <td>{size}</td> <td><a href="{url|urlescape}file/{symrev}/{file|urlescape}{sessionvars%urlparameter}">{basename|escape}</a></td> <td> <a href="{url|urlescape}file/{symrev}/{file|urlescape}{sessionvars%urlparameter}">file</a> | <a href="{url|urlescape}log/{symrev}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> | <a href="{url|urlescape}annotate/{symrev}/{file|urlescape}{sessionvars%urlparameter}">annotate</a> </td> </tr>' filerevision = filerevision.tmpl fileannotate = fileannotate.tmpl filediff = filediff.tmpl filecomparison = filecomparison.tmpl filelog = filelog.tmpl fileline = ' <a href="#{lineid}"></a><span id="{lineid}">{strip(line|escape, '\r\n')}</span>' annotateline = ' <tr id="{lineid}" class="parity{parity}{ifeq(node, originalnode, ' thisrev')}"> <td class="annotate linenr parity{blockparity}"> {if(blockhead, '<a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#l{targetline}"> {rev} </a>')} <div class="annotate-info"> <div> <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#l{targetline}"> {node|short}</a> {desc|escape|firstline} </div> <div><em>{author|obfuscate}</em></div> <div>parents: {parents%annotateparent}</div> <a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a> </div> </td> <td class="lineno"> <a href="#{lineid}">{linenumber}</a> </td> <td class="source">{line|escape}</td> </tr>' annotateparent = ' <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{rev}</a>' difflineplus = ' <a href="#{lineid}"></a><span id="{lineid}" class="difflineplus">{strip(line|escape, '\r\n')}</span>' difflineminus = ' <a href="#{lineid}"></a><span id="{lineid}" class="difflineminus">{strip(line|escape, '\r\n')}</span>' difflineat = ' <a href="#{lineid}"></a><span id="{lineid}" class="difflineat">{strip(line|escape, '\r\n')}</span>' diffline = ' <a href="#{lineid}"></a><span id="{lineid}">{strip(line|escape, '\r\n')}</span>' comparisonblock =' <tbody class="block"> {lines} </tbody>' comparisonline = ' <tr id="{lineid}"> <td class="source {type}"><a class="linenr" href="#{lineid}">{leftlinenumber}</a> {leftline|escape}</td> <td class="source {type}"><a class="linenr" href="#{lineid}">{rightlinenumber}</a> {rightline|escape}</td> </tr>' changesetlink = '<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>' changesetbranch = '<dt>branch</dt><dd>{name|escape}</dd>' changesetparent = ' <dt>parent {rev}</dt> <dd>{changesetlink}</dd>' changesetparentdiff = ' <dt>parent {rev}</dt> <dd>{changesetlink} {ifeq(node, basenode, '(current diff)', '({difffrom})')}</dd>' difffrom = '<a href="{url|urlescape}rev/{node|short}:{originalnode|short}{sessionvars%urlparameter}">diff</a>' filerevbranch = '<dt>branch</dt><dd>{name|escape}</dd>' filerevparent = ' <dt>parent {rev}</dt> <dd> <a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}"> {rename%filerename}{node|short} </a> </dd>' filerename = '{file|escape}@' filelogrename = '| <a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">base</a>' fileannotateparent = ' <dt>parent {rev}</dt> <dd> <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}"> {rename%filerename}{node|short} </a> </dd>' changesetchild = ' <dt>child {rev}</dt> <dd><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></dd>' filerevchild = ' <dt>child {rev}</dt> <dd> <a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a> </dd>' fileannotatechild = ' <dt>child {rev}</dt> <dd> <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a> </dd>' tags = tags.tmpl tagentry = ' <tr class="parity{parity}"> <td class="nowrap age">{date|rfc822date}</td> <td><a href="{url|urlescape}rev/{tag|revescape}{sessionvars%urlparameter}">{tag|escape}</a></td> <td class="nowrap"> <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a> | <a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">changelog</a> | <a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a> </td> </tr>' bookmarks = bookmarks.tmpl bookmarkentry = ' <tr class="parity{parity}"> <td class="nowrap age">{date|rfc822date}</td> <td><a href="{url|urlescape}rev/{bookmark|revescape}{sessionvars%urlparameter}">{bookmark|escape}</a></td> <td class="nowrap"> <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a> | <a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">changelog</a> | <a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a> </td> </tr>' branches = branches.tmpl branchentry = ' <tr class="parity{parity}"> <td class="nowrap age">{date|rfc822date}</td> <td class="{status}"><a href="{url|urlescape}shortlog/{branch|revescape}{sessionvars%urlparameter}">{branch|escape}</a></td> <td class="nowrap"> <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a> | <a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">changelog</a> | <a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a> </td> </tr>' diffblock = '<div class="diffblock"><pre class="sourcelines">{lines}</pre></div>' filediffparent = ' <dt>parent {rev}</dt> <dd><a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></dd>' filecompparent = ' <dt>parent {rev}</dt> <dd><a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></dd>' filediffchild = ' <dt>child {rev}</dt> <dd><a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></dd>' filecompchild = ' <dt>child {rev}</dt> <dd><a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></dd>' shortlog = shortlog.tmpl phasetag = '{ifeq(phase, 'public', '', '<span class="phasetag" title="{phase|escape}">{phase|escape}</span> ')}' obsoletetag = '{if(obsolete, '<span class="obsoletetag" title="obsolete">obsolete</span> ')}' instabilitytag = '<span class="instabilitytag" title="{instability|escape}">{instability|escape}</span> ' tagtag = '<span class="tagtag" title="{name|escape}">{name|escape}</span> ' branchtag = '<span class="branchtag" title="{name|escape}">{name|escape}</span> ' inbranchtag = '<span class="inbranchtag" title="{name|escape}">{name|escape}</span> ' bookmarktag = '<span class="bookmarktag" title="{name|escape}">{name|escape}</span> ' alltags = '<span class="logtags">{phasetag}{obsoletetag}{instabilities%instabilitytag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>' successorlink = '<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a> ' obsfatesuccessors = '{if(successors, ' as ')}{successors%successorlink}' obsfateverb = '{obsfateverb(successors, markers)}' obsfateoperations = '{if(obsfateoperations(markers), ' using {join(obsfateoperations(markers), ', ')}')}' obsfateusers = '{if(obsfateusers(markers), ' by {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}' obsfatedate = '{if(obsfatedate(markers), ' {ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), '<span class="age">{min(obsfatedate(markers))|rfc822date}</span>', 'between <span class="age">{min(obsfatedate(markers))|rfc822date}</span> and <span class="age">{max(obsfatedate(markers))|rfc822date}</span>')}')}' obsfateentry = ' <dt>obsolete</dt> <dd>{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}{obsfatedate}</dd>' instabilitychangesetlink = '<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>' divergentnode = '{instabilitychangesetlink} ({phase})' whyunstableentry = ' <dt>unstable</dt> <dd>{instability}: {if(divergentnodes, divergentnodes%divergentnode)} {reason} {instabilitychangesetlink}</dd>' shortlogentry = ' <tr class="parity{parity}"> <td class="nowrap age">{date|rfc822date}</td> <td>{author|person}</td> <td> <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}"> {desc|strip|firstline|escape|nonempty} {alltags} </a> </td> <td class="nowrap"> <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a> | <a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a> </td> </tr>' filelogentry = ' <tr class="parity{parity}"> <td class="nowrap age">{date|rfc822date}</td> <td>{author|person}</td> <td> <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}"> {desc|strip|firstline|escape|nonempty} {alltags} </a> </td> <td class="nowrap"> <a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a> | <a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> | <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a> {rename%filelogrename} </td> </tr>' archiveentry = '<li><a href="{url|urlescape}archive/{symrev}{extension}{ifeq(path,'/','',path|urlescape)}">{type|escape}</a></li>' indexentry = ' <tr class="parity{parity}"> <td><a href="{url|urlescape}{sessionvars%urlparameter}">{name|escape}</a></td> <td>{description}</td> <td>{contact|obfuscate}</td> <td class="age">{lastchange|rfc822date}</td> <td class="indexlinks">{archives%indexarchiveentry}</td> <td> {if(isdirectory, '', '<div class="rss_logo"> <a href="{url|urlescape}rss-log">RSS</a> <a href="{url|urlescape}atom-log">Atom</a> </div>' )} </td> </tr>\n' indexarchiveentry = '<a href="{url|urlescape}archive/{node|short}{extension}">{type|escape}</a> ' index = index.tmpl urlparameter = '{separator}{name}={value|urlescape}' hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />' graph = graph.tmpl graphentry = graphentry.tmpl breadcrumb = '> <a href="{url|urlescape}">{name|escape}</a> ' searchform = ' <form action="{url|urlescape}log"> {sessionvars%hiddenformentry} <dl class="search"> <dt><label>Search: </label></dt> <dd><input type="text" name="rev" value="{query|escape}" /></dd> </dl> </form>'