tests/test-revert
author Thomas Arendsen Hein <thomas@intevation.de>
Sat, 01 Apr 2006 11:58:50 +0200
changeset 2036 c9226bcc288d
parent 2029 d436b21b20dc
child 2042 a514c7509fa9
permissions -rwxr-xr-x
Don't abort when backup files already exist. Don't allow alternative names. Rationale: - When the user wants to revert, he shouldn't be stopped from doing this just because some old backups will be overwritten. - To not clobber important files by accident, alternative names for backup files were disabled. As the backup target now has a fixed name, the user doesn't have to be informed about the backup copy (unless --verbose)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1447
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     1
#!/bin/sh
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     2
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     3
hg init
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     4
echo 123 > a
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     5
echo 123 > c
2029
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
     6
echo 123 > e
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
     7
hg add a c e
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
     8
hg commit -m "first" -d "1000000 0" a c e
1447
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     9
echo 123 > b
1487
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1449
diff changeset
    10
echo %% should show b unknown
1447
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    11
hg status
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    12
echo 12 > c
1487
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1449
diff changeset
    13
echo %% should show b unknown and c modified
1447
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    14
hg status
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    15
hg add b
1487
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1449
diff changeset
    16
echo %% should show b added and c modified
1447
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    17
hg status
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    18
hg rm a
1487
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1449
diff changeset
    19
echo %% should show a removed, b added and c modified
1447
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    20
hg status
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    21
hg revert a
2029
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
    22
echo %% should show b added, copy saved, and c modified
1447
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    23
hg status
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    24
hg revert b
2036
c9226bcc288d Don't abort when backup files already exist. Don't allow alternative names.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2029
diff changeset
    25
echo %% should show b unknown, b.orig unknown, and c modified
2029
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
    26
hg status
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
    27
hg revert --no-backup c
2036
c9226bcc288d Don't abort when backup files already exist. Don't allow alternative names.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2029
diff changeset
    28
echo %% should show unknown: b b.orig
1447
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    29
hg status
2036
c9226bcc288d Don't abort when backup files already exist. Don't allow alternative names.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2029
diff changeset
    30
echo %% should show a b b.orig c e
1447
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    31
ls
2036
c9226bcc288d Don't abort when backup files already exist. Don't allow alternative names.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2029
diff changeset
    32
echo %% should verbosely save backup to e.orig
2029
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
    33
echo z > e
2036
c9226bcc288d Don't abort when backup files already exist. Don't allow alternative names.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2029
diff changeset
    34
hg revert -v
2029
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
    35
echo %% should say no changes needed
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
    36
hg revert a
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
    37
echo %% should say file not managed
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
    38
echo q > q
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
    39
hg revert q
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
    40
echo %% should say file not found
d436b21b20dc rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
    41
hg revert notfound
1447
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    42
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    43
true