changeset 13242:a8cef95cea88

subrepo: fix svnsubrepo.dirty() checking of ignoreupdate (issue2499) The ignoreupdate flag to subrepo.dirty(), introduced in be7e8e9bc5e5, is correctly checked with this change.
author Kevin Bullock <kbullock@ringworld.org>
date Tue, 04 Jan 2011 11:33:47 -0600
parents bb43a9abca80
children 159651b3c9ec
files mercurial/subrepo.py tests/test-mq-subrepo.t
diffstat 2 files changed, 40 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Fri Jan 07 17:44:23 2011 +0100
+++ b/mercurial/subrepo.py	Tue Jan 04 11:33:47 2011 -0600
@@ -544,7 +544,7 @@
 
     def dirty(self, ignoreupdate=False):
         if not self._wcchanged()[0]:
-            if self._wcrev() == self._state[1] and not ignoreupdate:
+            if self._wcrev() == self._state[1] or ignoreupdate:
                 return False
         return True
 
--- a/tests/test-mq-subrepo.t	Fri Jan 07 17:44:23 2011 +0100
+++ b/tests/test-mq-subrepo.t	Tue Jan 04 11:33:47 2011 -0600
@@ -345,3 +345,42 @@
   % debugsub should be empty
 
   $ cd ..
+
+
+handle svn subrepos safely
+
+  $ svnadmin create svn-repo-2499
+  $ curpath=`pwd | tr '\\\\' /`
+  $ expr "$svnpath" : "\/" > /dev/null
+  > if [ $? -ne 0 ]; then
+  >   curpath="/$curpath"
+  > fi
+  $ svnurl="file://$curpath/svn-repo-2499/project"
+  $ mkdir -p svn-project-2499/trunk
+  $ svn import -m 'init project' svn-project-2499 "$svnurl"
+  Adding         svn-project-2499/trunk
+  
+  Committed revision 1.
+
+qnew on repo w/svn subrepo
+  $ mkrepo repo-2499-svn-subrepo
+  $ svn co "$svnurl"/trunk sub
+  Checked out revision 1.
+  $ echo 'sub = [svn]sub' >> .hgsub
+  $ hg add .hgsub
+  $ hg status -S
+  A .hgsub
+  ? sub/.svn/entries
+  $ hg qnew -m0 0.diff
+  committing subrepository sub
+  $ cd sub
+  $ echo a > a
+  $ svn add a
+  A         a
+  $ svn st
+  A       a
+  $ cd ..
+  $ hg status -S        # doesn't show status for svn subrepos (yet)
+  $ hg qnew -m1 1.diff
+  abort: uncommitted changes in subrepository sub
+  [255]