Commits

Anonymous committed 8589af4

various updates and fixes

  • Participants
  • Parent commits fd74231

Comments (0)

Files changed (5)

 # Date 1260498662 -32400
 # Node ID c4aa42ea694eae77fe21a61191cd2c8d86b399bf
 # Parent  3d8d5b8162d41bcf16459bbc294222bbb7e14cb6
-add: only retrieve from dirstate.walk files that do exist on the filesystem
+add: only retrieve from dirstate.walk files that were not removed
 
-It does not make sense to match removed or missing files in this context.
+It does not make sense to match removed files in this context.
 It should suppress a bogus hg add warning when adding a directory over
 a removed file.
 
+The changes to test-mq is a partial revert of Martin's 46de82e50790 which
+introduced a temporary workaround to the hg add bug that we are addressing in
+this commit.
+
 diff --git a/mercurial/commands.py b/mercurial/commands.py
 --- a/mercurial/commands.py
 +++ b/mercurial/commands.py
      m.bad = lambda x,y: bad.append(x) or oldbad(x,y)
  
 -    for f in repo.walk(m):
-+    for f in repo.walk(m, existing_only=True):
++    for f in repo.walk(m, removed=False):
          exact = m.exact(f)
          if exact or f not in repo.dirstate:
              names.append(f)
          return changectx(self._repo, n)
  
 -    def walk(self, match):
-+    def walk(self, match, existing_only=False):
++    def walk(self, match, removed=True):
          fset = set(match.files())
          # for dirstate.walk, files=['.'] means "walk the whole tree".
          # follow that here, too
  
 -    def walk(self, match):
 -        return sorted(self._repo.dirstate.walk(match, True, False))
-+    def walk(self, match, existing_only=False):
++    def walk(self, match, removed=True):
 +        files = self._repo.dirstate.walk(match, True, False)
-+        if not existing_only:
++        if removed:
 +            return sorted(files)
 +        else:
 +            return sorted(k for k,v in files.iteritems() if v is not None)
          tags_.findglobaltags(self.ui, self, {}, {})
  
 -    def walk(self, match, node=None):
-+    def walk(self, match, node=None, existing_only=False):
++    def walk(self, match, node=None, removed=True):
          '''
          walk recursively through the directory tree or a given
          changeset, finding all files matched by the match
          function
          '''
 -        return self[node].walk(match)
-+        return self[node].walk(match, existing_only)
++        return self[node].walk(match, removed)
  
      def status(self, node1='.', node2=None, match=None,
                 ignored=False, clean=False, unknown=False):
-diff --git a/tests/test-rename-file-to-dir b/tests/test-rename-file-to-dir
-new file mode 100755
---- /dev/null
-+++ b/tests/test-rename-file-to-dir
-@@ -0,0 +1,15 @@
-+#!/bin/sh
+diff --git a/tests/test-mq b/tests/test-mq
+--- a/tests/test-mq
++++ b/tests/test-mq
+@@ -571,7 +571,6 @@
+ 
+ hg qnew rename-dir
+ hg rm a
+-hg qrefresh
+ 
+ mkdir a b
+ touch a/a b/b
+diff --git a/tests/test-rename b/tests/test-rename
+--- a/tests/test-rename
++++ b/tests/test-rename
+@@ -239,3 +239,15 @@
+ (cd d1/d11; hg rename ../../d2/b ../../../foo)
+ hg status -C
+ 
++hg ci -Aqm0
++touch removed missing
++hg ci -Aqm0
++hg rm removed
++rm missing
 +
-+hg init
++mkdir removed normal missing
++touch removed/a normal/a missing/a
 +
-+touch a
-+hg ci -Aqm"init"
-+hg rm a
-+
-+# now replace the file with a directory
-+mkdir a b
-+
-+touch a/a b/b
-+
-+# bug is here
-+hg add a b
-diff --git a/tests/test-rename-file-to-dir.out b/tests/test-rename-file-to-dir.out
-new file mode 100644
---- /dev/null
-+++ b/tests/test-rename-file-to-dir.out
-@@ -0,0 +1,2 @@
-+adding a/a
-+adding b/b
++hg add removed normal
++hg add missing # should fail
++hg st
+diff --git a/tests/test-rename.out b/tests/test-rename.out
+--- a/tests/test-rename.out
++++ b/tests/test-rename.out
+@@ -313,3 +313,12 @@
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ abort: path contains illegal component: .hg/foo
+ abort: ../../../foo not under root
++adding normal/a
++adding removed/a
++adding missing/a
++abort: file 'missing' in dirstate clashes with 'missing/a'
++A normal/a
++A removed/a
++R removed
++! missing
++? missing/a
 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
 --- a/mercurial/cmdutil.py
 +++ b/mercurial/cmdutil.py
-@@ -1280,10 +1280,10 @@
+@@ -1136,10 +1136,10 @@
      if ctx.branch():
          edittext.append(_("HG: branch '%s'")
                          % encoding.tolocal(ctx.branch()))
                                      (changed) and "+" or ""))
      else:
          ctx = repo[rev]
-@@ -2930,7 +2930,7 @@
+@@ -2907,7 +2907,7 @@
      tags = repo.tags()
  
      for p in parents:
 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
 --- a/mercurial/cmdutil.py
 +++ b/mercurial/cmdutil.py
-@@ -94,8 +94,6 @@
-         except ValueError:
+@@ -95,7 +95,7 @@
              raise util.Abort(_('limit must be a positive integer'))
          if limit <= 0: raise util.Abort(_('limit must be positive'))
--    else:
+     else:
 -        limit = sys.maxint
++        limit = None
      return limit
  
  def remoteui(src, opts):
                  break
              parents = [p for p in other.changelog.parents(n) if p != nullid]
              if opts.get('no_merges') and len(parents) == 2:
+@@ -2179,7 +2179,7 @@
+     displayer = cmdutil.show_changeset(ui, repo, opts)
+     count = 0
+     for n in o:
+-        if count >= limit:
++        if limit is not None and count >= limit:
+             break
+         parents = [p for p in repo.changelog.parents(n) if p != nullid]
+         if opts.get('no_merges') and len(parents) == 2:
 diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
 --- a/mercurial/graphmod.py
 +++ b/mercurial/graphmod.py
 -    if limit < sys.maxint:
 +    if limit is not None:
          lower = max(0, filerev - limit + 1)
-         # ignore the "stop" parameter
-         stop = -1
+     else:
+         lower = 0
+graphlimit
+loglimit
+iterators
+addbug
 subversionexception
-graphlimit
 symlink-basic
 dirstate-stat
 inotify-test-permissions
-addbug
 debug
-iterators
-loglimit
 no-match-under
 matching
 inotify-moverepo

File subversionexception

 -            ui.traceback()
 -            raise NoRepo("%s does not look like a Subversion repo" % self.url)
 +        except SubversionException, err:
-+            if err.apr_err == svn.core.SVN_ERR_FS_UNSUPPORTED_FORMAT:
-+                message = err.message + "foooooooooo"
++            if hasattr(err, "apr_err") and err.apr_err == svn.core.SVN_ERR_FS_UNSUPPORTED_FORMAT:
++                message = "svn: %s" % err.message
 +            else:
 +                ui.traceback()
-+                message = "%s does not look like a Subversion repo" % self.url)
++                message = "%s does not look like a Subversion repo" % self.url
 +            raise NoRepo(message)
  
          if rev: