changeset 15534:80ec63090a7a

merge with stable
author Matt Mackall <mpm@selenic.com>
date Sun, 20 Nov 2011 16:06:18 -0600
parents eeac5e179243 (current diff) 10a4fab20ed9 (diff)
children fbbb323ce697
files mercurial/subrepo.py
diffstat 4 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/help/urls.txt	Fri Nov 18 14:23:03 2011 +0100
+++ b/mercurial/help/urls.txt	Sun Nov 20 16:06:18 2011 -0600
@@ -1,7 +1,7 @@
 Valid URLs are of the form::
 
   local/filesystem/path[#revision]
-  file://localhost/filesystem/path[#revision]
+  file://local/filesystem/path[#revision]
   http://[user[:pass]@]host[:port]/[path][#revision]
   https://[user[:pass]@]host[:port]/[path][#revision]
   ssh://[user@]host[:port]/[path][#revision]
--- a/mercurial/revset.py	Fri Nov 18 14:23:03 2011 +0100
+++ b/mercurial/revset.py	Sun Nov 20 16:06:18 2011 -0600
@@ -434,7 +434,10 @@
     p = repo['.'].rev()
     if l:
         x = getstring(l[0], _("follow expected a filename"))
-        s = set(ctx.rev() for ctx in repo['.'][x].ancestors())
+        if x in repo['.']:
+            s = set(ctx.rev() for ctx in repo['.'][x].ancestors())
+        else:
+            return []
     else:
         s = set(repo.changelog.ancestors(p))
 
--- a/mercurial/subrepo.py	Fri Nov 18 14:23:03 2011 +0100
+++ b/mercurial/subrepo.py	Sun Nov 20 16:06:18 2011 -0600
@@ -823,6 +823,12 @@
     def _gitisbare(self):
         return self._gitcommand(['config', '--bool', 'core.bare']) == 'true'
 
+    def _gitupdatestat(self):
+        """This must be run before git diff-index.
+        diff-index only looks at changes to file stat;
+        this command looks at file contents and updates the stat."""
+        self._gitcommand(['update-index', '-q', '--refresh'])
+
     def _gitbranchmap(self):
         '''returns 2 things:
         a map from git branch to revision
@@ -892,6 +898,7 @@
             # different version checked out
             return True
         # check for staged changes or modified files; ignore untracked files
+        self._gitupdatestat()
         out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
         return code == 1
 
@@ -999,6 +1006,7 @@
         source, revision, kind = state
         self._fetch(source, revision)
         base = self._gitcommand(['merge-base', revision, self._state[1]])
+        self._gitupdatestat()
         out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
 
         def mergefunc():
@@ -1106,6 +1114,7 @@
             # if the repo is missing, return no results
             return [], [], [], [], [], [], []
         modified, added, removed = [], [], []
+        self._gitupdatestat()
         if rev2:
             command = ['diff-tree', rev1, rev2]
         else:
--- a/tests/test-subrepo-git.t	Fri Nov 18 14:23:03 2011 +0100
+++ b/tests/test-subrepo-git.t	Sun Nov 20 16:06:18 2011 -0600
@@ -361,6 +361,15 @@
   $ hg update -qC nosubstate
   $ ls s
 
+issue3109: false positives in git diff-index
+
+  $ hg update -q
+  $ touch -t 200001010000 s/g
+  $ hg status --subrepos
+  $ touch -t 200001010000 s/g
+  $ hg sum | grep commit
+  commit: (clean)
+
 Check hg update --clean
   $ cd $TESTTMP/ta
   $ echo  > s/g