sapling/mercurial
Augie Fackler 530be6f190 copy: distinguish "file exists" cases and add a hint (BC)
Users that want to add a copy record to an existing commit with 'hg
commit --amend' should be guided towards this workflow, rather than
reaching for some sort of uncommit-recommit flow. As part of this,
distinguish in the top-line error message whether the file merely
already exists (untracked) on disk or the file already exists in
history.

The full list of copy and rename cases and how they interact with
flags are listed below:

target exists  --after  --force  |  action
      n            n      *    |  copy
      n            y      *    |  (1)
  untracked        n      n    |  (4) NEWHINT
  untracked        n      y    |  (3)
  untracked        y      *    |  (2)
      y            n      n    |  (4) NEWHINT
      y            n      y    |  (3)
      y            y      n    |  (2)
      y            y      y    |  (3)
   deleted         n      n    |  copy
   deleted         n      y    |  (3)
   deleted         y      n    |  (1)
   deleted         y      y    |  (1)

* = don't care
(1) <src>: not recording move - <target> does not exist
(2) preserve target contents
(3) replace target contents
(4) <target>: not overwriting - file {exists,already committed}

Credit to Kevin for wholly rewriting my table to cover more cases we
discovered at the sprint.

I think this change gets the hints correct in all cases, but I'd
appreciate close inspection of the test cases to make sure I haven't
gotten turned around in here.
2016-09-19 17:15:39 -04:00
..
default.d mergetools.rc: find OSX FileMerge in the new location inside Xcode 4.3 2015-10-16 11:37:34 +02:00
help templater: provide arithmetic operations on integers 2016-10-09 05:51:04 -07:00
hgweb hgweb: fix the MRO in Python 3 2016-10-08 19:11:19 +02:00
httpclient httpclient: update to 54868ef054d2 of httpplus 2016-06-27 11:53:50 -04:00
pure lazymanifest: write a more efficient, pypy friendly version of lazymanifest 2016-09-12 13:37:14 +02:00
templates hgweb: avoid line wrap between revision and annotate-info (issue5398) 2016-10-08 19:32:54 +09:00
__init__.py py3: a second argument to open can't be bytes 2016-10-09 14:10:01 +02:00
ancestor.py py3: convert to next() function 2016-05-16 21:30:53 +00:00
archival.py py3: remove use of *L syntax 2016-09-01 02:29:46 +05:30
base85.c base85: fix comparison of an int and a long 2015-08-21 14:29:42 -04:00
bdiff_module.c bdiff: split bdiff into cpy-aware and cpy-agnostic part 2016-07-13 10:46:26 +02:00
bdiff.c bdiff: split bdiff into cpy-aware and cpy-agnostic part 2016-07-13 10:46:26 +02:00
bdiff.h bdiff: split bdiff into cpy-aware and cpy-agnostic part 2016-07-13 10:46:26 +02:00
bitmanipulation.h internals: move the bitmanipulation routines into its own file 2016-06-06 13:08:13 +02:00
bookmarks.py bookmarks: abort 'push -B .' when no active bookmark 2016-06-13 23:50:26 +02:00
branchmap.py branchmap: remove extra indent 2016-08-05 15:01:16 +02:00
bundle2.py pycompat: provide 'ispy3' constant 2016-09-28 20:01:23 +09:00
bundlerepo.py manifest: make one use of _mancache avoid manifestctxs 2016-09-12 14:29:09 -07:00
byterange.py pycompat: switch to util.urlreq/util.urlerr for py3 compat 2016-04-06 23:22:12 +00:00
changegroup.py manifest: add manifestctx.readdelta() 2016-09-13 16:25:21 -07:00
changelog.py changelog: specify checkambig=True to revlog.__init__, to avoid ambiguity 2016-09-22 21:51:59 +09:00
cmdutil.py copy: distinguish "file exists" cases and add a hint (BC) 2016-09-19 17:15:39 -04:00
commands.py debuginstall: use %d instead of %s for formatting an int 2016-10-09 09:42:46 -04:00
commandserver.py commandserver: update comment about setpgid 2016-07-18 15:59:08 +01:00
compat.h compat: define ssize_t as int on 32bit Windows, silences C4142 warning 2016-07-15 23:54:56 +09:00
config.py config: add hasconfig method and supporting plumbing 2016-01-07 19:45:03 -08:00
context.py annotate: calculate line count correctly 2016-10-01 14:18:58 +01:00
copies.py checkcopies: extract the '_related' closure 2016-10-11 01:29:08 +02:00
crecord.py crecord: properly handle files with No newline at eof (issue5268) 2016-09-02 20:15:37 +00:00
dagparser.py error: get Abort from 'error' instead of 'util' 2015-10-08 12:55:45 -07:00
dagutil.py dagutil: use absolute_import 2015-08-08 19:04:09 -07:00
demandimport.py demandimport: error out early on missing attribute of non package (issue5373) 2016-09-26 23:28:57 +09:00
destutil.py update: use single quotes in use warning 2016-09-02 21:49:33 +00:00
diffhelpers.c diffhelpers: fix botched return statement from e48d70075d8a 2015-01-28 13:34:20 -05:00
dirs.c dirs: add comment about _PyBytes_Resize 2016-10-13 10:59:29 +02:00
dirstate.py dirstate: rebuild should update dirstate properly 2016-08-30 15:16:28 -07:00
discovery.py discovery: use single quotes in use warning 2016-09-20 23:47:30 +00:00
dispatch.py dispatch: make hg --profile wrap reposetup 2016-09-22 12:36:30 -07:00
dummycert.pem ssl: on OS X, use a dummy cert to trick Python/OpenSSL to use system CA certs 2014-09-26 02:19:48 +02:00
encoding.py py3: provide encoding.environ which is a dict of bytes 2016-09-28 20:05:34 +09:00
error.py shelve: make unshelve be able to abort in any case 2016-07-13 16:16:18 +01:00
exchange.py pull: grab wlock during pull 2016-08-23 23:47:59 +02:00
exewrapper.c exewrapper: add .dll to LoadLibrary() argument 2016-04-27 09:23:39 -07:00
extensions.py extensions: move the "import" logic out from "load" 2016-10-03 03:37:10 +01:00
fancyopts.py flags: allow specifying --no-boolean-flag on the command line (BC) 2016-09-13 22:57:57 -04:00
filelog.py filelog: use absolute_import 2015-08-08 19:11:42 -07:00
filemerge.py py3: make format strings unicodes and not bytes 2016-10-08 16:10:58 +02:00
fileset.py help: clarify quotes are needed for filesets.size expressions 2016-09-21 16:33:37 +00:00
formatter.py py3: conditionalize cPickle import by adding in util 2016-06-04 14:38:00 +05:30
graphmod.py revset: add new topographical sort 2016-06-13 18:20:00 +01:00
hbisect.py bisect: move check_state into the bisect module 2016-08-24 04:25:20 +02:00
help.py help: mark boolean flags with [no-] to explain that they can be negated 2016-09-13 22:58:12 -04:00
hg.py merge: add conflict labels to merge command 2016-10-07 08:51:50 -07:00
hook.py hook: report untrusted hooks as failure (issue5110) (BC) 2016-04-14 02:41:15 -07:00
httpconnection.py largefiles: use context for file closing 2016-10-08 00:59:41 +02:00
httppeer.py py3: conditionalize httplib import 2016-06-28 16:01:53 +05:30
i18n.py i18n: make the locale directory name the same string type as the datapath 2016-10-08 05:26:18 -04:00
keepalive.py keepalive: switch from thread to threading module 2016-07-01 19:17:16 +05:30
localrepo.py localrepo: use single quotes in use warning 2016-09-20 23:48:08 +00:00
lock.py lock: clear postrelease hooks list after usage 2016-04-16 09:00:15 -07:00
lsprof.py lsprof: use print function 2016-01-02 11:40:53 -08:00
lsprofcalltree.py lsprofcalltree: use print function 2016-01-02 11:45:29 -08:00
mail.py mail: handle renamed email.Header 2016-10-07 17:30:11 +02:00
manifest.c manifest: convert PyString* to PyBytes* 2016-10-08 21:57:55 +02:00
manifest.py lazymanifest: write a more efficient, pypy friendly version of lazymanifest 2016-09-12 13:37:14 +02:00
match.py match: remove matchessubrepo method (API) 2016-08-16 08:21:16 +00:00
mdiff.py mdiff: remove unused parameter 'refine' from allblocks() 2016-09-27 14:46:34 +02:00
merge.py merge: update doc of manifestmerge() per ce7e15f82b44 2016-10-02 17:31:32 +09:00
minirst.py help: search section of help topic by translated section name correctly 2016-05-13 07:19:59 +09:00
mpatch_module.c mpatch: raise MemoryError instead of mpatchError if lalloc() failed 2016-08-07 10:06:56 +09:00
mpatch.c mpatch: raise MemoryError instead of mpatchError if lalloc() failed 2016-08-07 10:06:56 +09:00
mpatch.h mpatch: raise MemoryError instead of mpatchError if lalloc() failed 2016-08-07 10:06:56 +09:00
namespaces.py namespaces: fix name/node confusion 2016-03-16 23:12:43 +00:00
node.py node: use byte literals to construct nullid and wdirid 2016-03-12 14:04:57 -08:00
obsolete.py obsolete: use single quotes in use warning 2016-09-20 23:48:19 +00:00
osutil.c osutil: use PyLongObject on Python 3 for listdir_slot 2016-10-09 13:47:46 +02:00
parser.py parser: remove unused binding parameter from suffix action 2015-07-05 21:11:19 +09:00
parsers.c parsers: move PyInt aliasing out of util.h 2016-10-09 13:50:53 +02:00
patch.py import: abort instead of crashing when copy source does not exist (issue5375) 2016-10-08 05:26:58 -07:00
pathencode.c pathencode: use Py_SIZE directly 2016-10-08 22:21:22 +02:00
pathutil.py util: rename checkcase() to fscasesensitive() (API) 2016-08-30 09:22:53 -07:00
peer.py py3: convert to next() function 2016-05-16 21:30:53 +00:00
phases.py phases: make writing phaseroots file out avoid ambiguity of file stat 2016-06-03 00:44:20 +09:00
policy.py policy: add cffi policy for PyPy 2016-06-07 15:35:58 +02:00
posix.py chgserver: extract utility to bind unix domain socket to long path 2016-05-21 16:52:04 +09:00
profiling.py profiling: don't error with statprof when profiling has already started 2016-08-14 18:28:43 -07:00
progress.py progress: stop excessive clearing (issue4801) 2016-05-06 17:53:06 -05:00
pushkey.py pushkey: use absolute_import 2015-08-08 19:57:27 -07:00
pvec.py pvec: use absolute_import 2015-12-21 21:32:58 -08:00
py3kcompat.py py3compat: use absolute_import 2015-12-21 21:31:57 -08:00
pycompat.py pycompat: only accept a bytestring filepath in Python 2 2016-10-10 23:11:15 +01:00
registrar.py registrar: make format strings unicodes and not bytes 2016-10-07 08:32:18 -04:00
repair.py repair: open a file with checkambig=True to avoid file stat ambiguity 2016-09-22 21:52:00 +09:00
repoview.py cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1 2016-06-10 00:12:33 -04:00
revlog.py revlog: document high frequency of code execution 2016-08-24 20:18:58 -07:00
revset.py revset: build _syminitletters from a saner source: the string module 2016-10-07 08:32:40 -04:00
scmposix.py scmposix: use absolute_import 2015-12-21 21:24:49 -08:00
scmutil.py py3: use encoding.environ instead of os.environ 2016-10-09 12:37:10 +02:00
scmwindows.py py3: conditionalize _winreg import 2016-08-10 04:35:44 +05:30
setdiscovery.py setdiscovery: use iterbatch interface instead of batch 2016-03-01 17:44:41 -05:00
similar.py cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1 2016-06-10 00:12:33 -04:00
simplemerge.py merge: minimize conflicts when common base is not shown (issue4447) 2016-02-10 09:06:08 -08:00
sshpeer.py wireproto: consolidate code for obtaining "cmds" argument value 2016-08-06 13:46:28 -07:00
sshserver.py wireproto: rename argument to groupchunks() 2016-09-25 12:20:31 -07:00
sslutil.py ssl: handle a difference in SSLError with pypy (issue5348) 2016-09-13 17:46:29 +02:00
statichttprepo.py statichttprepo: do not try to write caches 2016-08-05 15:48:09 +02:00
store.py store: py26 compat, don't use a dict comprehension 2016-10-09 12:58:22 +02:00
streamclone.py streamclone: clear caches after writing changes into files for visibility 2016-09-12 03:06:29 +09:00
strutil.py strutil: use absolute_import 2015-08-08 20:01:40 -07:00
subrepo.py merge: use labels in subrepo merge 2016-10-08 01:25:28 -07:00
tagmerge.py tagmerge: use absolute_import 2015-08-08 20:10:46 -07:00
tags.py py3: convert to next() function 2016-05-16 21:30:53 +00:00
templatefilters.py pycompat: switch to util.urlreq/util.urlerr for py3 compat 2016-04-06 23:22:12 +00:00
templatekw.py template: provide a termwidth keyword (issue5395) 2016-10-08 02:26:48 -07:00
templater.py templater: handle division by zero in arithmetic 2016-10-09 08:09:20 -07:00
transaction.py transaction: open a file with checkambig=True to avoid file stat ambiguity 2016-09-22 21:52:00 +09:00
treediscovery.py error: get Abort from 'error' instead of 'util' 2015-10-08 12:55:45 -07:00
ui.py samplehgrcs: use single quotes in use warning 2016-09-20 23:49:00 +00:00
unionrepo.py unionrepo: properly handle hidden linkrev in revlog (issue5070) 2016-02-22 23:36:04 +01:00
url.py url: use iter(callable, sentinel) instead of while True 2016-08-05 14:00:39 -04:00
util.h parsers: move PyInt aliasing out of util.h 2016-10-09 13:50:53 +02:00
util.py util: ensure forwarded attrs are set in globals() as sysstr 2016-10-08 08:36:39 -04:00
verify.py verify: specify unit for ui.progress when checking files 2016-03-11 20:18:41 +08:00
win32.py win32: use absolute_import 2015-08-08 18:52:59 -07:00
windows.py py3: conditionalize _winreg import 2016-08-10 04:35:44 +05:30
wireproto.py wireproto: rename argument to groupchunks() 2016-09-25 12:20:31 -07:00
worker.py error: get Abort from 'error' instead of 'util' 2015-10-08 12:55:45 -07:00