Commit Graph

27 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
4d0ebd5133 tests: make timezone in diff output glob-ed for portability
Before this patch, some tests using external "diff" command via
extdiff extension fail on Solaris, because system standard "diff" (=
/usr/bin/diff) on Solaris doesn't display timezone for timestamp of
each files in diff output.

This patch makes timezone in external diff output glob-ed for
portability of tests, and adds check-code.py a rule to detect such
2016-02-08 18:29:17 +09:00
Siddharth Agarwal
a6dc53e738 simplemerge: move conflict warning message to filemerge
The current output for a failed merge with conflict markers looks something like:

  merging foo
  warning: conflicts during merge.
  merging foo incomplete! (edit conflicts, then use 'hg resolve --mark')
  merging bar
  warning: conflicts during merge.
  merging bar incomplete! (edit conflicts, then use 'hg resolve --mark')

We're going to change the way merges are done to perform all premerges before
all merges, so that the output above would look like:

  merging foo
  merging bar
  warning: conflicts during merge.
  merging foo incomplete! (edit conflicts, then use 'hg resolve --mark')
  warning: conflicts during merge.
  merging bar incomplete! (edit conflicts, then use 'hg resolve --mark')

The 'warning: conflicts during merge' line has no context, so is pretty
confusing.

This patch will change the future output to:

  merging foo
  merging bar
  warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
  warning: conflicts while merging bar! (edit, then use 'hg resolve --mark')

The hint on how to resolve the conflicts makes this a bit unwieldy, but solving
that is tricky because we already hint that people run 'hg resolve' to retry
unresolved merges. The 'hg resolve --mark' mostly applies to conflict marker
based resolution.
2015-10-09 13:54:52 -07:00
Matt Harbison
3c940eb21b match: fix a caseonly rename + explicit path commit on icasefs (issue4768)
The problem was that the former name and the new name are both normalized to the
case in dirstate, so matcher._files would be ['ABC.txt', 'ABC.txt'].
localrepo.commit() calls localrepo.status(), passing along the matcher.  Inside
dirstate.status(), _walkexplicit() simply grabs matcher.files() and processes
those items.  Since the old name isn't present, it is silently dropped.  There's
a fundamental tension here, because the status command should also accept files
that don't match the filesystem, so we can't drop the normalization in status.
The problem originated in d70aa474bd84.

Unfortunately with this change, the case of the old file must still be specified
exactly, or the old file is again silently excluded.  I went back to
d70aa474bd84^, and that had the same behavior, so we are no worse off.  I'm open
to ideas from a matcher or dirstate expert on how to fix that half.
2015-08-06 21:00:16 -04:00
Yuya Nishihara
0cf602f409 changeset_printer: display wdirrev/wdirnode values for workingctx
Because we want to eliminate "if"s in the default template, it makes sense to
display wdirrev/wdirnode values for now. wdir() is still experimental, so the
output of "log -r'wdir()'" may change in future.
2015-07-04 17:19:49 +09:00
Matt Harbison
b41110155b revset: fix a crash in parents() when 'wdir()' is in the set
The crash was "TypeError: expected string or Unicode object, NoneType found"
down in revlog.parentrevs().  This fixes heads() too (which is where I found
it.)
2015-06-29 10:34:56 -04:00
Matt Harbison
f2dec594fe test-add.t: fix output difference between Windows and OS X (issue4603) 2015-04-17 12:11:14 -04:00
Matt Harbison
041a91f971 match: add a subclass for dirstate normalizing of the matched patterns
This class is only needed on case insensitive filesystems, and only
for wdir context matches. It allows the user to not match the case of
the items in the filesystem- especially for naming directories, which
dirstate doesn't handle[1]. Making dirstate handle mismatched
directory cases is too expensive[2].

Since dirstate doesn't apply to committed csets, this is only created by
overriding basectx.match() in workingctx, and only on icasefs.  The default
arguments have been dropped, because the ctx must be passed to the matcher in
order to function.

For operations that can apply to both wdir and some other context, this ends up
normalizing the filename to the case as it exists in the filesystem, and using
that case for the lookup in the other context.  See the diff example in the
test.

Previously, given a directory with an inexact case:

  - add worked as expected

  - diff, forget and status would silently ignore the request

  - files would exit with 1

  - commit, revert and remove would fail (even when the commands leading up to
    them worked):

        $ hg ci -m "AbCDef" capsdir1/capsdir
        abort: CapsDir1/CapsDir: no match under directory!

        $ hg revert -r '.^' capsdir1/capsdir
        capsdir1\capsdir: no such file in rev 64dae27060b7

        $ hg remove capsdir1/capsdir
        not removing capsdir1\capsdir: no tracked files
        [1]

Globs are normalized, so that the -I and -X don't need to be specified with a
case match.  Without that, the second last remove (with -X) removes the files,
leaving nothing for the last remove.  However, specifying the files as
'glob:**.Txt' does not work.  Perhaps this requires 're.IGNORECASE'?

There are only a handful of places that create matchers directly, instead of
being routed through the context.match() method.  Some may benefit from changing
over to using ctx.match() as a factory function:

  revset.checkstatus()
  revset.contains()
  revset.filelog()
  revset._matchfiles()
  localrepository._loadfilter()
  ignore.ignore()
  fileset.subrepo()
  filemerge._picktool()
  overrides.addlargefiles()
  lfcommands.lfconvert()
  kwtemplate.__init__()
  eolfile.__init__()
  eolfile.checkrev()
  acl.buildmatch()

Currently, a toplevel subrepo can be named with an inexact case.  However, the
path auditor gets in the way of naming _anything_ in the subrepo if the top
level case doesn't match.  That is trickier to handle, because there's the user
provided case, the case in the filesystem, and the case stored in .hgsub.  This
can be fixed next cycle.

  --- a/tests/test-subrepo-deep-nested-change.t
  +++ b/tests/test-subrepo-deep-nested-change.t
  @@ -170,8 +170,15 @@
     R sub1/sub2/test.txt
     $ hg update -Cq
     $ touch sub1/sub2/folder/bar
  +#if icasefs
  +  $ hg addremove Sub1/sub2
  +  abort: path 'Sub1\sub2' is inside nested repo 'Sub1'
  +  [255]
  +  $ hg -q addremove sub1/sub2
  +#else
     $ hg addremove sub1/sub2
     adding sub1/sub2/folder/bar (glob)
  +#endif
     $ hg status -S
     A sub1/sub2/folder/bar
     ? foo/bar/abc

The narrowmatcher class may need to be tweaked when that is fixed.


[1] http://www.selenic.com/pipermail/mercurial-devel/2015-April/068183.html
[2] http://www.selenic.com/pipermail/mercurial-devel/2015-April/068191.html
2015-04-12 01:39:21 -04:00
Matt Harbison
cdcba76207 forget: cleanup the output for an inexact case match on icasefs
Previously, specifying a file name but not matching the dirstate case yielded
the following, even though the file was actually removed:

  $ hg forget capsdir1/capsdir/abc.txt
  not removing capsdir\a.txt: file is already untracked
  removing CapsDir\A.txt
  [1]

This change doesn't appear to cause any extra filesystem accesses, even if a
nonexistant file is specified.

If a directory is specified without a case match, it is (and was previously)
still silently ignored.
2015-03-31 17:42:46 -04:00
Matt Harbison
a3480284f9 dirstate: don't require exact case when adding dirs on icasefs (issue4578)
We don't require it when adding files on a case insensitive filesystem, so don't
require it to add directories for consistency.

The problem with the previous code was that _walkexplicit() was only returning
the normalized directory.  The file(s) in the directory are then appended, and
passed to the matcher.  But if the user asks for 'capsdir1/capsdir', the matcher
will not accept 'CapsDir1/CapsDir/AbC.txt', and the name is dropped.  Matching
based on the non-normalized name is required.

If not normalizing, skip the extra string building for efficiency.  '.' is
replaced with '' so that the path being tested when no file is specified, isn't
prefixed with './' (and therefore fail the match).
2015-03-31 11:11:39 -04:00
Martin von Zweigbergk
42c14b3ed1 add: add back forgotten files even when not matching exactly (BC)
I accidentally did 'hg forget .' and tried to undo the operation with
'hg add .'. I expected the files to be reported as either modified or
clean, but they were still reported as removed. It turns out that
forgotten files are only added back if they are listed explicitly, as
shown by the following two invocations. This makes it hard to recover
from the mistake of forgetting a lot of files.

  $ hg forget README && hg add README && hg status -A README
  C README
  $ hg forget README && hg add . && hg status -A README
  R README

The problem lies in cmdutil.add(). That method checks that the file
isn't already tracked before adding it, but it does so by checking the
dirstate, which does have an entry for forgotten files (state 'r'). We
should instead be checking whether the file exists in the
workingctx. The workingctx is also what we later call add() on, and
that method takes care of transforming the add() into a normallookup()
on the dirstate.

Since we're changing repo.dirstate into wctx, let's also change
repo.walk into wctx.walk for consistency (repo.walk calls wctx.walk,
so we're simply inlining the call).
2014-11-10 14:51:18 -08:00
Pierre-Yves David
3efa776f85 resolve: add parenthesis around "no more unresolved files" message
This message may be confused with an error message. Adding parenthesis around it
will make it more recognisable as an informative message.
2014-07-26 03:32:49 +02:00
Matt Mackall
0cb0a7ba67 resolve: simplify "finished" message
The recently introduced message was:

  no unresolved files; you may continue your unfinished operation

This had three problems:

- looks a bit like an error message because it's not saying "we've
  just resolved the last file"
- refers to "unfinished operation", which won't be the case with
  "update" or "merge"
- introduces semicolons to error messages, which is stylistically
  questionable

I've simplified this to:

  no more unresolved files

In the future, if we want to prompt someone to continue a particular operation, we should use
a hint style:

  no more unresolved files
  (use 'hg graft --continue' to finish grafting)
2014-05-09 14:46:50 -05:00
Gregory Szorc
85e363fea8 resolve: print message when no unresolved files remain (issue4214)
When using resolve, users often have to consult with the output of |hg
resolve -l| to see if any unresolved files remain. This step is tedious
and adds overhead to resolving.

This patch will notify a user if there are no unresolved files remaining
after executing |hg resolve|::

    no unresolved files; you may continue your unfinished operation

The patch stops short of telling the user exactly what command should be
executed to continue the unfinished operation. That is because this
information is not currently captured anywhere. This would make a
compelling follow-up feature.
2014-04-18 22:19:25 -07:00
Siddharth Agarwal
5fa78a0d83 merge: move forgets to the beginning of the action list
Forgets need to be in the beginning of the action list, same as removes. This
lets us avoid clashes in the dirstate where a directory is forgotten and a
file with the same name is added, or vice versa.
2013-11-06 10:20:18 -08:00
Mads Kiilerich
915c0dcd46 tests: use hghave eol-in-paths to test for support for ':' in filenames and " "
It is an approximation but seems to work ok ... and testing that 'foo:bar'
creates a real file and not just a resource fork is not completely trivial.
2012-06-15 00:02:27 +02:00
Mads Kiilerich
fa1c4e5ebe tests: add missing trailing 'cd ..'
Many tests didn't change back from subdirectories at the end of the tests ...
and they don't have to. The missing 'cd ..' could always be added when another
test case is added to the test file.

This change do that tests (99.5%) consistently end up in $TESTDIR where they
started, thus making it simpler to extend them or move them around.
2012-06-11 01:40:51 +02:00
Adrian Buehlmann
519e4c0d6f test-add: enable for Windows 2012-06-05 22:46:14 +02:00
Matt Mackall
309d28f3f5 merge with crew 2011-11-17 23:02:18 -06:00
Mads Kiilerich
637e2ecde2 tests: hide 'No such file or directory' messages
Windows will use a different and localized message.
2011-11-16 03:45:14 +01:00
Matt Mackall
66de5cde16 merge: give a special message for internal:merge failure (issue3105) 2011-11-16 18:04:19 -06:00
Mads Kiilerich
8344ac235d tests: use 'hghave no-windows' to avoid testing reserved file names on windows 2011-11-07 03:14:55 +01:00
Adrian Buehlmann
fc7e20743c add: introduce a warning message for non-portable filenames (issue2756) (BC)
On POSIX platforms, the 'add', 'addremove', 'copy' and 'rename' commands now
warn if a file has a name that can't be checked out on Windows.

Example:

  $ hg add con.xml
  warning: filename contains 'con', which is reserved on Windows: 'con.xml'
  $ hg status
  A con.xml

The file is added despite the warning.

The warning is ON by default. It can be suppressed by setting the config option
'portablefilenames' in section 'ui' to 'ignore' or 'false':

  $ hg --config ui.portablefilenames=ignore add con.xml
  $ hg sta
  A con.xml

If ui.portablefilenames is set to 'abort', then the command is aborted:

  $ hg --config ui.portablefilenames=abort add con.xml
  abort: filename contains 'con', which is reserved on Windows: 'con.xml'

On Windows, the ui.portablefilenames config setting is irrelevant and the
command is always aborted if a problematic filename is found.
2011-04-19 12:42:53 +02:00
Martin Geisler
3d112b3042 tests: added a short description to issue numbers
Many tests already had a short line to describe what IssueXXX is
about. I find that quite useful when reading a test.
2010-09-24 10:13:49 +02:00
Matt Mackall
ac660e9f65 tests: cleanup exit code handling in unified tests 2010-09-21 16:00:02 -05:00
Matt Mackall
08439e0f2d tests: add exit codes to unified tests 2010-09-16 17:51:32 -05:00
Brodie Rao
4be7b3bfc3 merge: suggest 'hg up -C .' for discarding changes, not 'hg up -C'
Without specifying the parent revision of the working copy, users will
update to tip, which is most likely the other head they were trying to
merge, not the revision they were at before the merge.
2010-09-12 18:05:53 -05:00
Nicolas Dumazet
582515a1a6 tests: unify test-add 2010-08-12 19:43:45 +09:00