Commit Graph

77 Commits

Author SHA1 Message Date
Pierre-Yves David
4ab7864481 test-revert: add methodical revert to "base" with explicit file path
We now also test reverting file to another revision's content. However
this differs from previously introduced test by using the explicit path
of each "case file" when calling revert. This should result in the
same result regarding file content and backup creation, but the output
of the `hg revert` call should differ.
2014-06-25 17:31:53 +01:00
Pierre-Yves David
0665e42a28 test-revert: add methodical revert with explicit file path
We now also test reverting file to the working directory parent
content. However this differs from the previously introduced test by using
the explicit path of each "case file" when calling revert. This should
result in the same result regarding file content and backup creation,
but the output of the `hg revert` call should differ.
2014-06-25 17:22:47 +01:00
Pierre-Yves David
dd045fbbfb test-revert: add methodical revert to "base"
We now also test reverting s file to the content of another revision. This is
still done using the `--all` flag.
2014-06-25 17:16:05 +01:00
Pierre-Yves David
c6c8698534 test-revert: add methodical revert to parent for working directory
Now that we can automatically generate states, we need to actually run
revert on them and check the result. While running such tests we are
checking multiple elements. The output of the `hg revert` command, the
resulting content of file, and the creation of backup file.

The first practical test is using the simple case `hg revert --all`, reverting
all files to working directory parent content.
2014-06-25 17:03:55 +01:00
Pierre-Yves David
364e062c1b test-revert: display the list of all generated cases
This will help to track all existing cases.

(still very simple now)
2014-06-25 17:24:18 +01:00
Pierre-Yves David
fa7f47cb83 test-revert: also create a text version of the snapshot
The text version is just a list of existing files with their content. We use a
small custom script for that.

This is going to be very useful for comparing revert results with
revert target content.
2014-06-27 16:08:09 +02:00
Pierre-Yves David
8e229da2ce test-revert: prepare methodical testing of revert cases
We introduce a script to generate revert cases and use it to prepare a test
repo.  See the inline documentation for details.
2014-06-25 16:37:06 +01:00
Pierre-Yves David
a08806c922 test-revert: drop useless comments
There are multiple comments explaining the expected output of commands. This is
an old relic of the pre-unified test era. We remove them for uselessness.
2014-06-25 15:59:21 +01:00
Pierre-Yves David
5681b6942f test-revert: improve comment
We highlight the behavior tested by each sections. (This is a gratuitous
improvement before significant upgrade of the test and massive refactoring of
the revert code)
2014-06-25 15:58:05 +01:00
Pierre-Yves David
ca87e2a8ca revert: use p2 as parent when reverting against it
revert was always using p1 as parent. This created some minor misbehavior when
reverting against p2. See test change for an example of that.

This is also a useful cleanup for coming refactoring to revert.
2014-05-14 10:38:05 -07:00
Pierre-Yves David
4a6b74a80e revert: add a test case to reverting "add" during merges
This kind of revert is specifically trickier since the file is
reported as "modified" by status. This case was only tested by some
largefiles test. We introduce proper testing of all aspects of this
case in the revert tests themselves.
2014-05-13 17:28:19 -07:00
Bryan O'Sullivan
c787225d04 revert: ensure that copies and renames are honored (issue3920)
Previously, we restored the states of files, but not the additional
information the dirstate uses to track copies and renames.
2013-05-03 12:40:17 -07: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
6043ceae50 test-revert: enable for Windows 2012-06-08 15:11:05 +02: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
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
adfff587c7 tests: use 'hghave execbit' for tests that manipulate x bit in file system 2011-11-07 03:14:54 +01:00
Adrian Buehlmann
13cd3f341f test-revert: add revert --all case when nothing changed
supposed to succeed without notice
2011-06-28 00:56:33 +02:00
Adrian Buehlmann
9b3812c8c6 revert: improve hints on abort when reverting to parent without --all
BEFORE:

    $ hg revert
    abort: no files or directories specified
    (use --all to discard all changes)

AFTER:

  Uncommitted changes (using --all *will* nuke edits):

    $ hg revert
    abort: no files or directories specified
    (uncommitted changes, use --all to discard all changes)

  Clean working directory (using --all won't discard anything):

    $ hg revert
    abort: no files or directories specified
    (use --all to revert all files)
2011-06-26 01:13:30 +02:00
Adrian Buehlmann
bb2cb4edc9 test-revert: add case for nothing changed 2011-06-24 23:29:51 +02:00
Adrian Buehlmann
1d541dffa3 revert: mention update in hint of abort when reverting to non-parent
and explicitly warn about uncommitted changes

Examples:

BEFORE:

    $ hg par -q
    7:e81a2efd53d4
    $ hg revert -r 2
    abort: no files or directories specified
    (use --all to discard all changes)

AFTER:

  Clean working directory (revert can be easily undone, no edits to be lost):

    $ hg revert -r 2
    abort: no files or directories specified
    (use --all to revert all files, or 'hg update 2' to update)

  Uncommitted changes (revert --all *does* discard edits and is pretty hard to
  undo or even impossible if --no-backup is specified):

    $ hg revert -r 2
    abort: no files or directories specified
    (uncommitted changes, use --all to discard all changes, or 'hg update 2' to update)
2011-06-24 12:37:29 +02:00
Kevin Bullock
99e4d74da2 revert: be more explicit that changes are lost
BEFORE:
   $ hg revert
   abort: no files or directories specified
   (use --all to revert all files)

 AFTER:
   $ hg revert
   abort: no files or directories specified
   (use --all to discard all changes)
2011-06-20 22:15:52 -05:00
Matt Mackall
40ee99d81f revert: drop requirement to use -r to revert with two parents
This reduces documentation confusion between the need to:

a) hg revert -a -r .  (drop all changes from a merge)
b) hg up -C .         (drop the second parent entirely)

Currently revert is one of two commands (the other being tag) that
still complains about uncommitted merges, dating from its former use
of a generic defaultrev function that aborted.
2011-06-07 14:19:05 -05: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
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
a0476898ab tests: unify test-revert 2010-08-30 13:32:37 +09:00