changeset 16287:38a36dc5a34e stable

merge with i18n
author Matt Mackall <mpm@selenic.com>
date Tue, 27 Mar 2012 14:35:58 -0500
parents 6c4dbe28dda3 (diff) 3c147aca78dd (current diff)
children 09f2bb3a37b5
files
diffstat 4 files changed, 45 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py	Tue Mar 27 20:37:52 2012 +0900
+++ b/hgext/largefiles/reposetup.py	Tue Mar 27 14:35:58 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 @@
                         orig_ignore = 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	Tue Mar 27 20:37:52 2012 +0900
+++ b/hgext/rebase.py	Tue Mar 27 14:35:58 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	Tue Mar 27 20:37:52 2012 +0900
+++ b/mercurial/cmdutil.py	Tue Mar 27 14:35:58 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	Tue Mar 27 20:37:52 2012 +0900
+++ b/tests/test-largefiles.t	Tue Mar 27 14:35:58 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