changeset 21936:1ce8df4b2322 stable

merge with i18n
author Matt Mackall <mpm@selenic.com>
date Wed, 23 Jul 2014 10:50:21 -0500
parents 0cb34b3991f8 (diff) 87f6908a286d (current diff)
children 54ff2789d75e
files
diffstat 13 files changed, 140 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Sun Jul 20 18:08:29 2014 -0300
+++ b/contrib/check-code.py	Wed Jul 23 10:50:21 2014 -0500
@@ -168,6 +168,8 @@
     (r'^  .*: largefile \S+ not available from file:.*/.*[^)]$', winglobmsg),
     (r'^  .*file://\$TESTTMP',
      'write "file:/*/$TESTTMP" + (glob) to match on windows too'),
+    (r'^  (cat|find): .*: No such file or directory',
+     'use test -f to test for file existence'),
   ],
   # warnings
   [
--- a/hgext/largefiles/lfcommands.py	Sun Jul 20 18:08:29 2014 -0300
+++ b/hgext/largefiles/lfcommands.py	Wed Jul 23 10:50:21 2014 -0500
@@ -435,7 +435,8 @@
         ui.status(_("%d largefiles failed to download\n") % totalmissing)
     return totalsuccess, totalmissing
 
-def updatelfiles(ui, repo, filelist=None, printmessage=True):
+def updatelfiles(ui, repo, filelist=None, printmessage=True,
+                 normallookup=False):
     wlock = repo.wlock()
     try:
         lfdirstate = lfutil.openlfdirstate(ui, repo)
@@ -509,15 +510,20 @@
 
             updated += update1
 
-            state = repo.dirstate[lfutil.standin(lfile)]
+            standin = lfutil.standin(lfile)
+            if standin in repo.dirstate:
+                stat = repo.dirstate._map[standin]
+                state, mtime = stat[0], stat[3]
+            else:
+                state, mtime = '?', -1
             if state == 'n':
-                # When rebasing, we need to synchronize the standin and the
-                # largefile, because otherwise the largefile will get reverted.
-                # But for commit's sake, we have to mark the file as unclean.
-                if getattr(repo, "_isrebasing", False):
+                if normallookup or mtime < 0:
+                    # state 'n' doesn't ensure 'clean' in this case
                     lfdirstate.normallookup(lfile)
                 else:
                     lfdirstate.normal(lfile)
+            elif state == 'm':
+                lfdirstate.normallookup(lfile)
             elif state == 'r':
                 lfdirstate.remove(lfile)
             elif state == 'a':
--- a/hgext/largefiles/overrides.py	Sun Jul 20 18:08:29 2014 -0300
+++ b/hgext/largefiles/overrides.py	Wed Jul 23 10:50:21 2014 -0500
@@ -667,7 +667,13 @@
 
         newstandins = lfutil.getstandinsstate(repo)
         filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
-        lfcommands.updatelfiles(ui, repo, filelist, printmessage=False)
+        # lfdirstate should be 'normallookup'-ed for updated files,
+        # because reverting doesn't touch dirstate for 'normal' files
+        # when target revision is explicitly specified: in such case,
+        # 'n' and valid timestamp in dirstate doesn't ensure 'clean'
+        # of target (standin) file.
+        lfcommands.updatelfiles(ui, repo, filelist, printmessage=False,
+                                normallookup=True)
 
     finally:
         wlock.release()
--- a/mercurial/commands.py	Sun Jul 20 18:08:29 2014 -0300
+++ b/mercurial/commands.py	Wed Jul 23 10:50:21 2014 -0500
@@ -3785,7 +3785,7 @@
     by hand before :hg:`commit --amend` is run to update the created
     changeset. This flag exists to let people import patches that
     partially apply without losing the associated metadata (author,
-    date, description, ...), Note that when none of the hunk applies
+    date, description, ...). Note that when none of the hunk applies
     cleanly, :hg:`import --partial` will create an empty changeset,
     importing only the patch metadata.
 
--- a/mercurial/dirstate.py	Sun Jul 20 18:08:29 2014 -0300
+++ b/mercurial/dirstate.py	Wed Jul 23 10:50:21 2014 -0500
@@ -504,6 +504,14 @@
     def write(self):
         if not self._dirty:
             return
+
+        # enough 'delaywrite' prevents 'pack_dirstate' from dropping
+        # timestamp of each entries in dirstate, because of 'now > mtime'
+        delaywrite = self._ui.configint('debug', 'dirstate.delaywrite', 0)
+        if delaywrite:
+            import time # to avoid useless import
+            time.sleep(delaywrite)
+
         st = self._opener("dirstate", "w", atomictemp=True)
         # use the modification time of the newly created temporary file as the
         # filesystem's notion of 'now'
--- a/tests/test-histedit-edit.t	Sun Jul 20 18:08:29 2014 -0300
+++ b/tests/test-histedit-edit.t	Wed Jul 23 10:50:21 2014 -0500
@@ -233,8 +233,7 @@
   > EOF
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   abort: emulating unexpected abort
-  $ cat .hg/last-message.txt
-  cat: .hg/last-message.txt: No such file or directory
+  $ test -f .hg/last-message.txt
   [1]
 
   $ cat >> .hg/hgrc <<EOF
--- a/tests/test-issue3084.t	Sun Jul 20 18:08:29 2014 -0300
+++ b/tests/test-issue3084.t	Wed Jul 23 10:50:21 2014 -0500
@@ -165,8 +165,7 @@
   $ chmod 755 .hg
 #endif
 
-  $ find .hg/largefiles
-  find: `.hg/largefiles': No such file or directory
+  $ test -f .hg/largefiles
   [1]
 
 ancestor is "normal":
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-largefiles-update.t	Wed Jul 23 10:50:21 2014 -0500
@@ -0,0 +1,102 @@
+This file focuses mainly on updating largefiles in the working
+directory (and ".hg/largefiles/dirstate")
+
+  $ cat >> $HGRCPATH <<EOF
+  > [ui]
+  > merge = internal:fail
+  > [extensions]
+  > largefiles =
+  > EOF
+
+  $ hg init repo
+  $ cd repo
+
+  $ echo large1 > large1
+  $ echo large2 > large2
+  $ hg add --large large1 large2
+  $ echo normal1 > normal1
+  $ hg add normal1
+  $ hg commit -m '#0'
+  $ echo 'large1 in #1' > large1
+  $ echo 'normal1 in #1' > normal1
+  $ hg commit -m '#1'
+  $ hg update -q -C 0
+  $ echo 'large2 in #2' > large2
+  $ hg commit -m '#2'
+  created new head
+
+Test that "hg merge" updates largefiles from "other" correctly
+
+(getting largefiles from "other" normally)
+
+  $ hg status -A large1
+  C large1
+  $ cat large1
+  large1
+  $ cat .hglf/large1
+  4669e532d5b2c093a78eca010077e708a071bb64
+  $ hg merge --config debug.dirstate.delaywrite=2
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  getting changed largefiles
+  1 largefiles updated, 0 removed
+  $ hg status -A large1
+  M large1
+  $ cat large1
+  large1 in #1
+  $ cat .hglf/large1
+  58e24f733a964da346e2407a2bee99d9001184f5
+  $ hg diff -c 1 --nodates .hglf/large1 | grep '^[+-][0-9a-z]'
+  -4669e532d5b2c093a78eca010077e708a071bb64
+  +58e24f733a964da346e2407a2bee99d9001184f5
+
+(getting largefiles from "other" via conflict prompt)
+
+  $ hg update -q -C 2
+  $ echo 'large1 in #3' > large1
+  $ echo 'normal1 in #3' > normal1
+  $ hg commit -m '#3'
+  $ cat .hglf/large1
+  e5bb990443d6a92aaf7223813720f7566c9dd05b
+  $ hg merge --config debug.dirstate.delaywrite=2 --config ui.interactive=True <<EOF
+  > o
+  > EOF
+  largefile large1 has a merge conflict
+  ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
+  keep (l)ocal e5bb990443d6a92aaf7223813720f7566c9dd05b or
+  take (o)ther 58e24f733a964da346e2407a2bee99d9001184f5? merging normal1
+  warning: conflicts during merge.
+  merging normal1 incomplete! (edit conflicts, then use 'hg resolve --mark')
+  0 files updated, 1 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
+  getting changed largefiles
+  1 largefiles updated, 0 removed
+  [1]
+  $ hg status -A large1
+  M large1
+  $ cat large1
+  large1 in #1
+  $ cat .hglf/large1
+  58e24f733a964da346e2407a2bee99d9001184f5
+
+Test that "hg revert -r REV" updates largefiles from "REV" correctly
+
+  $ hg update -q -C 3
+  $ hg status -A large1
+  C large1
+  $ cat large1
+  large1 in #3
+  $ cat .hglf/large1
+  e5bb990443d6a92aaf7223813720f7566c9dd05b
+  $ hg diff -c 1 --nodates .hglf/large1 | grep '^[+-][0-9a-z]'
+  -4669e532d5b2c093a78eca010077e708a071bb64
+  +58e24f733a964da346e2407a2bee99d9001184f5
+  $ hg revert --no-backup -r 1 --config debug.dirstate.delaywrite=2 large1
+  $ hg status -A large1
+  M large1
+  $ cat large1
+  large1 in #1
+  $ cat .hglf/large1
+  58e24f733a964da346e2407a2bee99d9001184f5
+
+  $ cd ..
--- a/tests/test-mq-qfold.t	Sun Jul 20 18:08:29 2014 -0300
+++ b/tests/test-mq-qfold.t	Wed Jul 23 10:50:21 2014 -0500
@@ -182,8 +182,7 @@
   refresh interrupted while patch was popped! (revert --all, qpush to recover)
   abort: emulating unexpected abort
   [255]
-  $ cat .hg/last-message.txt
-  cat: .hg/last-message.txt: No such file or directory
+  $ test -f .hg/last-message.txt
   [1]
 
 (reset applied patches and directory status)
--- a/tests/test-mq-qnew.t	Sun Jul 20 18:08:29 2014 -0300
+++ b/tests/test-mq-qnew.t	Wed Jul 23 10:50:21 2014 -0500
@@ -268,8 +268,7 @@
   $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch
   abort: emulating unexpected abort
   [255]
-  $ cat .hg/last-message.txt
-  cat: .hg/last-message.txt: No such file or directory
+  $ test -f .hg/last-message.txt
   [1]
 
 (test that editor is invoked and commit message is saved into
--- a/tests/test-mq-qrefresh-replace-log-message.t	Sun Jul 20 18:08:29 2014 -0300
+++ b/tests/test-mq-qrefresh-replace-log-message.t	Wed Jul 23 10:50:21 2014 -0500
@@ -133,8 +133,7 @@
   refresh interrupted while patch was popped! (revert --all, qpush to recover)
   abort: emulating unexpected abort
   [255]
-  $ cat .hg/last-message.txt
-  cat: .hg/last-message.txt: No such file or directory
+  $ test -f .hg/last-message.txt
   [1]
 
 (reset applied patches and directory status)
--- a/tests/test-subrepo-svn.t	Sun Jul 20 18:08:29 2014 -0300
+++ b/tests/test-subrepo-svn.t	Wed Jul 23 10:50:21 2014 -0500
@@ -672,11 +672,9 @@
   $ cd tc
   $ grep ' s$' .hgsubstate
   16 s
-  $ cat s/.hg/hgrc
-  cat: s/.hg/hgrc: No such file or directory
+  $ test -f s/.hg/hgrc
   [1]
-  $ cat s/sub/.hg/hgrc
-  cat: s/sub/.hg/hgrc: No such file or directory
+  $ test -f s/sub/.hg/hgrc
   [1]
 
 Test that sanitizing is omitted in meta data area:
--- a/tests/test-tag.t	Sun Jul 20 18:08:29 2014 -0300
+++ b/tests/test-tag.t	Wed Jul 23 10:50:21 2014 -0500
@@ -242,8 +242,7 @@
   $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
   abort: pretag.test-saving-lastmessage hook exited with status 1
   [255]
-  $ cat .hg/last-message.txt
-  cat: .hg/last-message.txt: No such file or directory
+  $ test -f .hg/last-message.txt
   [1]
 
 (test that editor is invoked and commit message is saved into