changeset 13036:77aa74fe0e0b

merge with stable
author Matt Mackall <mpm@selenic.com>
date Mon, 22 Nov 2010 13:11:46 -0600
parents 8cb33163b391 (current diff) f08df4d38442 (diff)
children 9beac11b8c56
files hgext/mq.py
diffstat 2 files changed, 82 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Mon Nov 22 17:32:51 2010 +0100
+++ b/hgext/mq.py	Mon Nov 22 13:11:46 2010 -0600
@@ -1310,12 +1310,18 @@
             # local dirstate. in this case, we want them to only
             # show up in the added section
             for x in m:
+                if x == '.hgsub' or x == '.hgsubstate':
+                    self.ui.warn(_('warning: not refreshing %s\n') % x)
+                    continue
                 if x not in aa:
                     mm.add(x)
             # we might end up with files added by the local dirstate that
             # were deleted by the patch.  In this case, they should only
             # show up in the changed section.
             for x in a:
+                if x == '.hgsub' or x == '.hgsubstate':
+                    self.ui.warn(_('warning: not adding %s\n') % x)
+                    continue
                 if x in dd:
                     dd.remove(x)
                     mm.add(x)
@@ -1325,6 +1331,9 @@
             # are not in the add or change column of the patch
             forget = []
             for x in d + r:
+                if x == '.hgsub' or x == '.hgsubstate':
+                    self.ui.warn(_('warning: not removing %s\n') % x)
+                    continue
                 if x in aa:
                     aa.remove(x)
                     forget.append(x)
--- a/tests/test-mq-qrefresh.t	Mon Nov 22 17:32:51 2010 +0100
+++ b/tests/test-mq-qrefresh.t	Mon Nov 22 13:11:46 2010 -0600
@@ -487,3 +487,76 @@
 
   $ cd ..
 
+
+Issue2499: refuse to add .hgsub{,state} to a patch
+
+  $ hg init repo-2499
+  $ cd repo-2499
+  $ hg qinit
+  $ hg qnew -m 0 0.diff
+  $ echo a > a
+  $ hg init sub
+  $ cd sub
+  $ echo b > b
+  $ hg ci -Am 0sub
+  adding b
+  $ cd ..
+
+test when adding
+  $ echo sub = sub > .hgsub
+  $ echo `hg id -i --debug sub` sub > .hgsubstate
+  $ hg add
+  adding .hgsub
+  adding .hgsubstate
+  adding a
+  $ hg qrefresh
+  warning: not adding .hgsub
+  warning: not adding .hgsubstate
+  $ hg qfinish -a
+  $ hg status
+  A .hgsub
+  A .hgsubstate
+  $ hg forget .hgsubstate
+  $ rm .hgsubstate
+
+add subrepo with a real commit
+  $ hg ci -m 1
+  committing subrepository sub
+  $ hg qnew -m 2 2.diff
+
+test when modifying
+  $ echo sub2 = sub2 >> .hgsub
+  $ hg qrefresh
+  warning: not refreshing .hgsub
+  $ echo 0000000000000000000000000000000000000000 sub2 >> .hgsubstate
+  $ hg qrefresh
+  warning: not refreshing .hgsub
+  warning: not refreshing .hgsubstate
+  $ hg revert --no-backup .hgsub .hgsubstate
+
+test when removing
+  $ hg rm .hgsub
+  $ hg rm .hgsubstate
+  $ hg qrefresh
+  warning: not removing .hgsub
+  warning: not removing .hgsubstate
+  $ hg status
+  R .hgsub
+  R .hgsubstate
+  $ hg revert --no-backup .hgsub .hgsubstate
+
+test when deleting
+  $ rm .hgsub .hgsubstate
+  $ hg qrefresh
+  warning: not removing .hgsub
+  warning: not removing .hgsubstate
+  refresh interrupted while patch was popped! (revert --all, qpush to recover)
+  abort: No such file or directory: $TESTTMP/repo-2499/.hgsub
+  [255]
+  $ hg status
+  ! .hgsub
+  ! .hgsubstate
+  $ hg cat -r1 .hgsub > .hgsub
+  $ hg revert --no-backup .hgsubstate
+
+  $ cd ..