Mercurial > hg-stable
changeset 42008:7f6b375a8903
fix: allow fixing untracked files when given as arguments
It's more useful to fix the file than to silently avoid it when the user does
this:
hg fix --working-dir untracked-file
We will still do nothing to ignored files, even if they are specified. This may
be safer, given that such files can unexpectedly slip into the arguments via a
shell glob or fileset.
Differential Revision: https://phab.mercurial-scm.org/D6165
author | Danny Hooper <hooper@google.com> |
---|---|
date | Thu, 21 Mar 2019 18:35:39 -0700 |
parents | b5511845f9d5 |
children | 8f427f7c1f71 |
files | hgext/fix.py tests/test-fix.t |
diffstat | 2 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/fix.py Tue Mar 19 16:26:52 2019 +0300 +++ b/hgext/fix.py Thu Mar 21 18:35:39 2019 -0700 @@ -282,8 +282,6 @@ match = scmutil.match(fixctx, pats, opts) for path in pathstofix(ui, repo, pats, opts, match, basectxs[rev], fixctx): - if path not in fixctx: - continue fctx = fixctx[path] if fctx.islink(): continue
--- a/tests/test-fix.t Tue Mar 19 16:26:52 2019 +0300 +++ b/tests/test-fix.t Thu Mar 21 18:35:39 2019 -0700 @@ -354,6 +354,10 @@ $ printf "modified!!!\n" > modified.whole $ printf "added\n" > added.whole + +Listing the files explicitly causes untracked files to also be fixed, but +ignored files are still unaffected. + $ hg fix --working-dir *.whole $ hg status --all @@ -366,13 +370,12 @@ I ignored.whole C .hgignore -It would be better if this also fixed the unknown file. $ cat *.whole ADDED CLEAN ignored MODIFIED!!! - unknown + UNKNOWN $ cd ..