changeset 16285:e53c0b2d7b60

merge with stable
author Matt Mackall <mpm@selenic.com>
date Mon, 26 Mar 2012 16:42:53 -0500
parents 2b0a406d3043 (current diff) 6c4dbe28dda3 (diff)
children 9952ac7e0968
files hgext/largefiles/reposetup.py tests/test-largefiles.t
diffstat 4 files changed, 45 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py	Mon Mar 26 16:41:54 2012 -0500
+++ b/hgext/largefiles/reposetup.py	Mon Mar 26 16:42:53 2012 -0500
@@ -137,8 +137,11 @@
                 # Create a copy of match that matches standins instead
                 # of largefiles.
                 def tostandin(file):
-                    if inctx(lfutil.standin(file), ctx2):
-                        return lfutil.standin(file)
+                    if working:
+                        sf = lfutil.standin(file)
+                        dirstate = repo.dirstate
+                        if sf in dirstate or sf in dirstate.dirs():
+                            return sf
                     return file
 
                 # Create a function that we can use to override what is
@@ -167,8 +170,12 @@
                         origignore = lfdirstate._ignore
                         lfdirstate._ignore = _ignoreoverride
 
-                        match._files = [f for f in match._files if f in
-                            lfdirstate]
+                        def sfindirstate(f):
+                            sf = lfutil.standin(f)
+                            dirstate = repo.dirstate
+                            return sf in dirstate or sf in dirstate.dirs()
+                        match._files = [f for f in match._files
+                                        if sfindirstate(f)]
                         # Don't waste time getting the ignored and unknown
                         # files again; we already have them
                         s = lfdirstate.status(match, [], False,
--- a/hgext/rebase.py	Mon Mar 26 16:41:54 2012 -0500
+++ b/hgext/rebase.py	Mon Mar 26 16:42:53 2012 -0500
@@ -557,15 +557,18 @@
 
 def abort(repo, originalwd, target, state):
     'Restore the repository to its original state'
-    descendants = repo.changelog.descendants
-    ispublic = lambda r: repo._phaserev[r] == phases.public
-    if filter(ispublic, descendants(target)):
+    dstates = [s for s in state.values() if s != nullrev]
+    if [d for d in dstates if not repo[d].mutable()]:
         repo.ui.warn(_("warning: immutable rebased changeset detected, "
                        "can't abort\n"))
         return -1
-    elif set(descendants(target)) - set(state.values()):
+
+    descendants = set()
+    if dstates:
+        descendants = set(repo.changelog.descendants(*dstates))
+    if descendants - set(dstates):
         repo.ui.warn(_("warning: new changesets detected on target branch, "
-                                                    "can't abort\n"))
+                       "can't abort\n"))
         return -1
     else:
         # Strip from the first rebased revision
--- a/mercurial/cmdutil.py	Mon Mar 26 16:41:54 2012 -0500
+++ b/mercurial/cmdutil.py	Mon Mar 26 16:42:53 2012 -0500
@@ -285,6 +285,16 @@
 
         # check for overwrites
         exists = os.path.lexists(target)
+        samefile = False
+        if exists and abssrc != abstarget:
+            if (repo.dirstate.normalize(abssrc) ==
+                repo.dirstate.normalize(abstarget)):
+                if not rename:
+                    ui.warn(_("%s: can't copy - same file\n") % reltarget)
+                    return
+                exists = False
+                samefile = True
+
         if not after and exists or after and state in 'mn':
             if not opts['force']:
                 ui.warn(_('%s: not overwriting - file exists\n') %
@@ -307,7 +317,12 @@
                 targetdir = os.path.dirname(target) or '.'
                 if not os.path.isdir(targetdir):
                     os.makedirs(targetdir)
-                util.copyfile(src, target)
+                if samefile:
+                    tmp = target + "~hgrename"
+                    os.rename(src, tmp)
+                    os.rename(tmp, target)
+                else:
+                    util.copyfile(src, target)
                 srcexists = True
             except IOError, inst:
                 if inst.errno == errno.ENOENT:
@@ -330,7 +345,7 @@
         scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget,
                              dryrun=dryrun, cwd=cwd)
         if rename and not dryrun:
-            if not after and srcexists:
+            if not after and srcexists and not samefile:
                 util.unlinkpath(repo.wjoin(abssrc))
             wctx.forget([abssrc])
 
--- a/tests/test-largefiles.t	Mon Mar 26 16:41:54 2012 -0500
+++ b/tests/test-largefiles.t	Mon Mar 26 16:42:53 2012 -0500
@@ -68,6 +68,8 @@
 Remove both largefiles and normal files.
  
   $ hg remove normal1 large1
+  $ hg status large1
+  R large1
   $ hg commit -m "remove files"
   Invoking status precommit hook
   R large1
@@ -249,6 +251,13 @@
   A sub2/large6
   A sub2/large7
 
+Test "hg status" with combination of 'file pattern' and 'directory
+pattern' for largefiles:
+
+  $ hg status sub2/large6 sub2
+  A sub2/large6
+  A sub2/large7
+
 Config settings (pattern **.dat, minsize 2 MB) are respected.
 
   $ echo testdata > test.dat