changeset 13339:22167be007ed stable

subrepo: fix pruning of subrepo filenames in dirstate (issue2619)
author trbs <trbs@trbs.net>
date Fri, 04 Feb 2011 09:05:23 +0100
parents 5fc7c84ed9b0
children 02aa06a021a0
files mercurial/dirstate.py tests/test-subrepo-recursion.t
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Tue Feb 01 17:30:13 2011 -0600
+++ b/mercurial/dirstate.py	Fri Feb 04 09:05:23 2011 +0100
@@ -506,7 +506,7 @@
             if files[i] < subpath:
                 i += 1
                 continue
-            while files and files[i].startswith(subpath):
+            while i < len(files) and files[i].startswith(subpath):
                 del files[i]
             j += 1
 
--- a/tests/test-subrepo-recursion.t	Tue Feb 01 17:30:13 2011 -0600
+++ b/tests/test-subrepo-recursion.t	Fri Feb 04 09:05:23 2011 +0100
@@ -346,3 +346,15 @@
   $ rm -r foo
   $ hg status -S
   warning: error "unknown revision '65903cebad86f1a84bd4f1134f62fa7dcb7a1c98'" in subrepository "foo"
+
+Issue2619: IndexError: list index out of range on hg add with subrepos
+The subrepo must sorts after the explicit filename.
+
+  $ cd ..
+  $ hg init test
+  $ cd test
+  $ hg init x
+  $ echo "x = x" >> .hgsub
+  $ hg add .hgsub
+  $ touch a x/a
+  $ hg add a x/a