diff tests/test-revert @ 6031:7383384793fb

revert: don't assume ignored files will be returned in the unknown list That's just an artifact of the current implementation, and I'll change that soon. Bonus points: - we don't care about the unknown list at all - we don't print an extra message if we try to revert a removed file that is not present in the target revision
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 08 Feb 2008 18:07:55 -0200
parents bfd73b567b3d
children 242595e612ed
line wrap: on
line diff
--- a/tests/test-revert	Fri Feb 08 18:07:55 2008 -0200
+++ b/tests/test-revert	Fri Feb 08 18:07:55 2008 -0200
@@ -1,6 +1,7 @@
 #!/bin/sh
 
-hg init
+hg init repo
+cd repo
 echo 123 > a
 echo 123 > c
 echo 123 > e
@@ -40,19 +41,26 @@
 rm q
 echo %% should say file not found
 hg revert notfound
+touch d
+hg add d
 hg rm a
 hg commit -m "second" -d "1000000 0"
 echo z > z
 hg add z
 hg st
-echo %% should add a, forget z
+echo %% should add a, remove d, forget z
 hg revert --all -r0
-echo %% should forget a
+echo %% should forget a, undelete d
 hg revert --all -rtip
 rm a *.orig
 echo %% should silently add a
 hg revert -r0 a
 hg st a
+hg rm d
+hg st d
+echo %% should silently keep d removed
+hg revert -r0 d
+hg st d
 
 hg update -C
 chmod +x c
@@ -68,6 +76,8 @@
 echo %% should print executable
 test -x c && echo executable
 
+cd ..
+
 echo %% issue 241
 hg init a
 cd a
@@ -100,3 +110,33 @@
 hg revert newa
 hg st a newa
 
+cd ..
+
+hg init ignored
+cd ignored
+echo '^ignored$' > .hgignore
+echo '^ignoreddir$' >> .hgignore
+echo '^removed$' >> .hgignore
+
+mkdir ignoreddir
+touch ignoreddir/file
+touch ignoreddir/removed
+touch ignored
+touch removed
+echo '%% 4 ignored files (we will add/commit everything)'
+hg st -A -X .hgignore
+hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed
+
+echo >> ignored
+echo >> ignoreddir/file
+hg rm removed ignoreddir/removed
+echo '%% should revert ignored* and undelete *removed'
+hg revert -a --no-backup
+hg st -mardi
+
+hg up -qC
+echo >> ignored
+hg rm removed
+echo %% should silently revert the named files
+hg revert --no-backup ignored removed
+hg st -mardi