[PATCH 1 of 6 DEFAULT] tests: add test for behavior of remove for explicit path in subrepo

David M. Carr david at carrclan.us
Sat Jan 14 15:00:16 UTC 2012


# HG changeset patch
# User David M. Carr  <david at carrclan.us>
# Date 1326502565 18000
# Node ID 670ebd709125c14cc6e91f6eb5c59b09297e9f1e
# Parent  e5feebc1f3bb50f0180c76d31e8456a390a86c78
tests: add test for behavior of remove for explicit path in subrepo

Adds a section to test-subrepo.t that demonstrates the current behavior
when you pass the full path to a file in a subrepo to hg remove.

diff -r e5feebc1f3bb -r 670ebd709125 tests/test-subrepo.t
--- a/tests/test-subrepo.t	Fri Jan 13 11:29:53 2012 -0600
+++ b/tests/test-subrepo.t	Fri Jan 13 19:56:05 2012 -0500
@@ -1,3 +1,12 @@
+  $ remove() {
+  >     hg rm $@
+  >     echo "exit code: $?" # no-check-code
+  >     hg st -S
+  >     # do not use ls -R, which recurses in .hg subdirs on Mac OS X 10.5
+  >     find . -name ".hg*" -prune -o -type f -print | sort
+  >     hg up -C
+  > }
+
 Let commit recurse into subrepos by default to match pre-2.0 behavior:
 
   $ echo "[ui]" >> $HGRCPATH
@@ -1033,3 +1042,84 @@
   $ hg st -S
   ? s/f19
   $ rm s/f19
+
+Test behavior of remove for explicit path in subrepo:
+Removing an explicit path in a subrepo currently gives a file untracked warn
+  $ hg rm -R s s/f*
+  $ echo c1 > s/f1
+  $ hg ci -R s -Am6
+  adding f1
+  $ hg rm f*
+  $ hg ci -m7
+  committing subrepository s
+Attempt to remove clean file with after
+  $ remove -A s/f1
+  not removing s/f1: file is untracked
+  exit code: 1
+  ./s/f1
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Attempt to remove clean file with no opts
+  $ remove s/f1
+  not removing s/f1: file is untracked
+  exit code: 1
+  ./s/f1
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Attempt to remove modified file with no opts
+  $ echo c1 >> s/f1
+  $ remove s/f1
+  not removing s/f1: file is untracked
+  exit code: 1
+  M s/f1
+  ./s/f1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Attempt to remove modified file with after
+  $ echo c1 >> s/f1
+  $ remove -A s/f1
+  not removing s/f1: file is untracked
+  exit code: 1
+  M s/f1
+  ./s/f1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Attempt to remove modified file with force
+  $ echo c1 >> s/f1
+  $ remove -f s/f1
+  not removing s/f1: file is untracked
+  exit code: 1
+  M s/f1
+  ./s/f1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Attempt to remove missing file with no opts
+  $ rm s/f1
+  $ remove s/f1
+  exit code: 1
+  ! s/f1
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg revert -R s s/f1
+Attempt to remove added file with no opts
+  $ echo c2 > s/f2
+  $ hg add s/f2
+  $ remove s/f2
+  not removing s/f2: file is untracked
+  exit code: 1
+  A s/f2
+  ./s/f1
+  ./s/f2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Attempt to remove added file with after
+  $ hg add s/f2
+  $ remove -A s/f2
+  not removing s/f2: file is untracked
+  exit code: 1
+  A s/f2
+  ./s/f1
+  ./s/f2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Attempt to remove added file with force
+  $ hg add s/f2
+  $ remove -f s/f2
+  not removing s/f2: file is untracked
+  exit code: 1
+  A s/f2
+  ./s/f1
+  ./s/f2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved



More information about the Mercurial-devel mailing list