Commit Graph

23 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
aa3e672d5a tests: add fsmonitor specific output lines at enabling largefiles
Temporarily enabling largefiles causes these output lines, only if
tests are executed with fsmonitor.
2017-07-03 02:52:39 +09:00
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
Gilles Moris
c60f7ce967 summary: move the parents phase marker to commit line (issue4688)
The phase of the pending commit depends on the parent of the working directory
and on the phases.newcommit configuration.
First, this information rather depend on the commit line which describe the
pending commit.
Then, we only want to be advertised when the pending phase is going to be higher
than the default new commit phase.

So the format will change from

$ hg summary
parent: 2:ab91dfabc5ad
 foo
parent: 3:24f1031ad244 tip
 bar
branch: default
commit: 1 modified, 1 unknown, 1 unresolved (merge)
update: (current)
phases: 1 secret (secret)

to

parent: 2:ab91dfabc5ad
 foo
parent: 3:24f1031ad244 tip
 bar
branch: default
commit: 1 modified, 1 unknown, 1 unresolved (merge) (secret)
update: (current)
phases: 1 secret
2015-05-29 22:23:58 +02:00
Gilles Moris
7771de9187 summary: add a phase line (draft, secret) to the output
The number of draft and secret changesets are currently not summarized.
This is an important information because the number of drafts give some rough
idea of the number of outgoing changesets in typical workflows, without needing
to probe a remote repository. And a non-zero number of secrets means that
those changeset will not be pushed.

If the repository is "dirty" - some draft or secret changesets exists - then
summary will display a line like:

phases: X draft, Y secret (public)

The phase in parenthesis corresponds to the highest phase of the parents of
the working directory, i.e. the current phase.

By default, the line is not printed if the repository is "clean" - all
changesets are public - but if verbose is activated, it will display:

phases: (public)

On the other hand, nothing will be printed if quiet is in action.

A few tests have been added in test-phases.t to cover the -v and -q cases.
2015-05-14 17:38:38 +02:00
Matt Harbison
c23410b6b1 largefiles: use the core file copy logic to validate the destination path
The destination is validated by pathutil.canonpath() for illegal components, and
that it is in the repository.  The logic for creating the standin directory tree
was calling this before cmdutil.copy(), but without the destination file name
component.  The cmdutil.copy() logic also calls pathutil.canonpath(), but with
the file name component.  By always calling the core logic first, the error
message is always consistent.  Specifically, the old behavior for these tests
was to say '.hg' contains an illegal component, and '..' is not under root.

A user wasn't likely to notice the discrepancy, but this eliminates a needless
difference when running the test suite with --config extensions.largefiles=.
2015-01-31 00:13:29 -05:00
Pierre-Yves David
8db67ed78a rename: properly report removed and added file as modified (issue4458)
The result of 'hg rm' + 'hg rename' disagreed with the one from
'hg rename --force'. We align them on 'hg move --force' because it agrees with
what 'hg status' says after the commit.

Stopping reporting a modified file as added puts an end to the hg revert confusion in this
situation (issue4458).

However, reporting the file as modified also prevents revert from restoring the copy
source. We fix this in a later changeset.

Git diff also stop reporting the add in the middle of the chain as add. Not
sure how important (and even wrong) it is.
2014-11-24 18:42:56 -08:00
Pierre-Yves David
bb7457d4d7 manifest: fix a bug where working copy file 'add' mark was buggy
Because the same dictionary was used to (1) get node from parent and (2) store
annotated version, we could end up with buggy values. For example with a chain
of renames:

  $ hg mv b c
  $ hg mv a b

The value from 'b' would be updated as "<old-a>a", then the value of c would be
updated as "<old-b>a'. With the current dictionary sharing this ends up with:

    '<new-c>' == '<old-a>aa'

This value is double-wrong as we should use '<old-b>' and a single 'a'.

We now use a read-only value for lookup. The 'test-rename.t' test is impacted
because such a chained added file is suddenly detected as such.
2014-11-26 14:54:16 -08:00
Mads Kiilerich
4f2a779466 tests: fix for windows - slashes and no serve 2013-01-30 19:40:07 +01:00
Mads Kiilerich
84f8ae3223 scmutil: localize and improve 'not under root' message 2013-01-18 01:24:29 +01:00
timeless@mozdev.org
f029229d67 spelling: nonexistent 2012-08-17 13:58:18 -07:00
Adrian Buehlmann
59baf53223 test-rename.t: enable for Windows 2012-06-10 17:10:53 +02:00
Mads Kiilerich
8c22a0ec28 tests: make (glob) on windows accept \ instead of /
Globbing is usually used for filenames, so on windows it is reasonable and very
convenient that glob patterns accepts '\' or '/' when the pattern specifies
'/'.
2011-11-07 03:25:10 +01:00
Mads Kiilerich
4838bfb2c4 tests: use 'hghave symlink' for tests using symlinks 2011-11-07 03:14:54 +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
e98a6b16fb test-rename: test with absolute paths 2010-11-01 16:22:41 +01:00
Martin Geisler
785c45e367 test-rename: fix \" -> " in comments 2010-11-01 16:19:06 +01:00
Mads Kiilerich
f8b22bcaa0 test-rename: accept solaris diff
Solaris diff gives
@@ -1,1 +1,1 @@
instead of
@@ -1 +1 @@
2010-09-25 02:35:36 +02:00
Brodie Rao
b5fe0d906e tests: add glob matching for unified tests
This adds a " (glob)" marker that works like a simpler version of
(re): "*" is converted to ".*", and "?" is converted to ".".

Both special characters can be escaped using "\", and the backslash
itself can be escaped as well.

Other glob-style syntax, like "**", "[chars]", or "[!chars]", isn't
supported.
2010-09-22 16:06:02 -05:00
Brodie Rao
7d7d96bd74 tests: require regexes in unified tests to be marked with " (re)"
Consider this test:

  $ hg glog --template '{rev}:{node|short} "{desc}"\n'
  @  2:20c4f79fd7ac "3"
  |
  | o  1:38f24201dcab "2"
  |/
  o  0:2a18120dc1c9 "1"

Because each line beginning with "|" can be compiled as a regular
expression (equivalent to ".*|"), they will match any output.

Similarly:

  $ echo foo


The blank output line can be compiled as a regular expression and will
also match any output.

With this patch, none of the above output lines will be matched as
regular expressions. A line must end in " (re)" in order to be matched
as one.

Lines are still matched literally first, so the following will pass:

  $ echo 'foo (re)'
  foo (re)
2010-09-22 16:06:00 -05:00
Patrick Mezard
614db673f4 Merge with stable 2010-09-20 22:29:13 +02:00
Matt Mackall
08439e0f2d tests: add exit codes to unified tests 2010-09-16 17:51:32 -05:00
Martin Geisler
cc612c476f tests: remove unneeded -d flags
Many tests fixed the commit date of their changesets at '1000000 0' or
similar. However testing with "Mon Jan 12 13:46:40 1970 +0000" is not
better than testing with "Thu Jan 01 00:00:00 1970 +0000", which is
the default run-tests.py installs.

Removing the unnecessary flag removes some clutter and will hopefully
make it clearer what the tests are really trying to test. Some tests
did not even change their output when the dates were changed, in which
case the -d flag was truly irrelevant.

Dates used in sequence (such as '0 0', '1 0', etc...) were left alone
since they may make the test easier to understand.
2010-09-02 23:22:51 +02:00
Nicolas Dumazet
c78d8b3cfb tests: unify test-rename 2010-08-30 12:58:43 +09:00