Patchwork [7,of,7,PoC] largefiles: replace mocking inside commit with wrapper in commit command

login
register
mail settings
Submitter Mads Kiilerich
Date Sept. 22, 2014, 9:13 a.m.
Message ID <bdc9ece90981e847819c.1411377220@localhost.localdomain>
Download mbox | patch
Permalink /patch/5912/
State Deferred
Headers show

Comments

Mads Kiilerich - Sept. 22, 2014, 9:13 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1411377060 -7200
#      Mon Sep 22 11:11:00 2014 +0200
# Node ID bdc9ece90981e847819c724dba395752d706411e
# Parent  bed515d62820344a33e554500c3abb40bda37b05
largefiles: replace mocking inside commit with wrapper in commit command

Patch

diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -189,16 +189,6 @@  def copytostore(repo, rev, file, uploade
         return
     copytostoreabsolute(repo, repo.wjoin(file), hash)
 
-def copyalltostore(repo, node):
-    '''Copy all largefiles in a given revision to the store'''
-
-    ctx = repo[node]
-    for filename in ctx.files():
-        if isstandin(filename) and filename in ctx.manifest():
-            realfile = splitstandin(filename)
-            copytostore(repo, ctx.node(), realfile)
-
-
 def copytostoreabsolute(repo, file, hash):
     if inusercache(repo.ui, hash):
         link(usercachepath(repo.ui, hash), storepath(repo, hash))
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -679,26 +679,22 @@  def overridepull(orig, ui, repo, source=
         source = 'default'
     repo.lfpullsource = source
     if opts.get('rebase', False):
-        repo._isrebasing = True
+        if opts.get('update'):
+            del opts['update']
+            ui.debug('--update and --rebase are not compatible, ignoring '
+                     'the update flag\n')
+        del opts['rebase']
+        origpostincoming = commands.postincoming
+        def _dummy(*args, **kwargs):
+            pass
+        commands.postincoming = _dummy
         try:
-            if opts.get('update'):
-                del opts['update']
-                ui.debug('--update and --rebase are not compatible, ignoring '
-                         'the update flag\n')
-            del opts['rebase']
-            origpostincoming = commands.postincoming
-            def _dummy(*args, **kwargs):
-                pass
-            commands.postincoming = _dummy
-            try:
-                result = commands.pull(ui, repo, source, **opts)
-            finally:
-                commands.postincoming = origpostincoming
-            revspostpull = len(repo)
-            if revspostpull > revsprepull:
-                result = result or rebase.rebase(ui, repo)
+            result = commands.pull(ui, repo, source, **opts)
         finally:
-            repo._isrebasing = False
+            commands.postincoming = origpostincoming
+        revspostpull = len(repo)
+        if revspostpull > revsprepull:
+            result = result or rebase.rebase(ui, repo)
     else:
         result = orig(ui, repo, source, **opts)
     revspostpull = len(repo)
@@ -778,11 +774,33 @@  def hgclone(orig, ui, opts, *args, **kwa
 
 @lfutil.standintolargefiles(printmessage=False)
 def overriderebase(orig, ui, repo, **opts):
-    repo._isrebasing = True
+    return orig(ui, repo, **opts)
+
+def overridecommit(orig, ui, repo, *args, **opts):
+    wlock = repo.wlock()
     try:
-        return orig(ui, repo, **opts)
+        lfdirstate = lfutil.openlfdirstate(ui, repo)
+        lmodified, ladded, lremoved = \
+            lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev())[:3]
+        lfdirstate.write()
+        for lfile in lmodified + ladded:
+            lfutil.updatestandin(repo, lfutil.standin(lfile))
+
+        ret = orig(ui, repo, *args, **opts)
+
+        modified, added, removed, deleted = repo.status()[:4]
+        ctx = repo['.']
+        for filename in sorted(set(lmodified + ladded) - set(modified + added)):
+            if lfutil.standin(filename) in ctx.manifest():
+                lfutil.copytostore(repo, ctx.node(), filename)
+                lfdirstate.normal(filename)
+        for filename in sorted(set(lremoved) - set(removed)):
+            if lfutil.standin(filename) not in ctx.manifest():
+                lfdirstate.drop(filename)
+        lfdirstate.write()
     finally:
-        repo._isrebasing = False
+        wlock.release()
+    return ret
 
 def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None,
             prefix=None, mtime=None, subrepos=None):
@@ -1122,12 +1140,7 @@  def overriderollback(orig, ui, repo, **o
 
 @lfutil.standintolargefiles(printmessage=True)
 def overridetransplant(orig, ui, repo, *revs, **opts):
-    try:
-        repo._istransplanting = True
-        result = orig(ui, repo, *revs, **opts)
-    finally:
-        repo._istransplanting = False
-    return result
+    return orig(ui, repo, *revs, **opts)
 
 def overridecat(orig, ui, repo, file1, *pats, **opts):
     ctx = scmutil.revsingle(repo, opts.get('rev'))
@@ -1186,11 +1199,4 @@  def mercurialsinkafter(orig, sink):
     orig(sink)
 
 def scmutilmarktouched(orig, repo, files, *args, **kwargs):
-    result = orig(repo, files, *args, **kwargs)
-
-    filelist = [lfutil.splitstandin(f) for f in files if lfutil.isstandin(f)]
-    if filelist:
-        lfcommands.updatelfiles(repo.ui, repo, filelist=filelist,
-                                printmessage=False, normallookup=True)
-
-    return result
+    return orig(repo, files, *args, **kwargs)
diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -256,46 +256,12 @@  def reposetup(ui, repo):
                 self.lfstatus = True
                 return result
 
-        # As part of committing, copy all of the largefiles into the
-        # cache.
-        def commitctx(self, *args, **kwargs):
-            node = super(lfilesrepo, self).commitctx(*args, **kwargs)
-            lfutil.copyalltostore(self, node)
-            return node
-
-        # Before commit, largefile standins have not had their
-        # contents updated to reflect the hash of their largefile.
-        # Do that here.
         def commit(self, text="", user=None, date=None, match=None,
                 force=False, editor=False, extra={}):
             orig = super(lfilesrepo, self).commit
 
             wlock = self.wlock()
             try:
-                # Case 0: Automated committing
-                #
-                # While automated committing (like rebase, transplant
-                # and so on), this code path is used to avoid:
-                # (1) updating standins, because standins should
-                #     be already updated at this point
-                # (2) aborting when stadnins are matched by "match",
-                #     because automated committing may specify them directly
-                #
-                if getattr(self, "_isrebasing", False) or \
-                        getattr(self, "_istransplanting", False):
-                    result = orig(text=text, user=user, date=date, match=match,
-                                    force=force, editor=editor, extra=extra)
-
-                    if result:
-                        lfdirstate = lfutil.openlfdirstate(ui, self)
-                        for f in self[result].files():
-                            if lfutil.isstandin(f):
-                                lfile = lfutil.splitstandin(f)
-                                lfutil.synclfdirstate(self, lfdirstate, lfile,
-                                                      False)
-                        lfdirstate.write()
-
-                    return result
                 # Case 1: user calls commit with no specific files or
                 # include/exclude patterns: refresh and commit all files that
                 # are "dirty".
@@ -329,18 +295,6 @@  def reposetup(ui, repo):
 
                     result = orig(text=text, user=user, date=date, match=match,
                                     force=force, editor=editor, extra=extra)
-
-                    if result is not None:
-                        for lfile in lfdirstate:
-                            if lfile in modifiedfiles:
-                                if (not os.path.exists(self.wjoin(
-                                   lfutil.standin(lfile)))) or \
-                                   (not os.path.exists(self.wjoin(lfile))):
-                                    lfdirstate.drop(lfile)
-
-                    # This needs to be after commit; otherwise precommit hooks
-                    # get the wrong status
-                    lfdirstate.write()
                     return result
 
                 lfiles = lfutil.listlfiles(self)
@@ -357,20 +311,6 @@  def reposetup(ui, repo):
                     return orig(text=text, user=user, date=date, match=match,
                                     force=force, editor=editor, extra=extra)
 
-                # Refresh all matching big files.  It's possible that the
-                # commit will end up failing, in which case the big files will
-                # stay refreshed.  No harm done: the user modified them and
-                # asked to commit them, so sooner or later we're going to
-                # refresh the standins.  Might as well leave them refreshed.
-                lfdirstate = lfutil.openlfdirstate(ui, self)
-                for standin in standins:
-                    lfile = lfutil.splitstandin(standin)
-                    if lfdirstate[lfile] != 'r':
-                        lfutil.updatestandin(self, standin)
-                        lfdirstate.normal(lfile)
-                    else:
-                        lfdirstate.drop(lfile)
-
                 # Cook up a new matcher that only matches regular files or
                 # standins corresponding to the big files requested by the
                 # user.  Have to modify _files to prevent commit() from
@@ -407,9 +347,6 @@  def reposetup(ui, repo):
                 match.matchfn = matchfn
                 result = orig(text=text, user=user, date=date, match=match,
                                 force=force, editor=editor, extra=extra)
-                # This needs to be after commit; otherwise precommit hooks
-                # get the wrong status
-                lfdirstate.write()
                 return result
             finally:
                 wlock.release()
diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py
--- a/hgext/largefiles/uisetup.py
+++ b/hgext/largefiles/uisetup.py
@@ -75,6 +75,8 @@  def uisetup(ui):
     entry[1].extend(summaryopt)
     cmdutil.summaryremotehooks.add('largefiles', overrides.summaryremotehook)
 
+    entry = extensions.wrapcommand(commands.table, 'commit',
+                                   overrides.overridecommit)
     entry = extensions.wrapcommand(commands.table, 'update',
                                    overrides.overrideupdate)
     entry = extensions.wrapcommand(commands.table, 'merge',
diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t
--- a/tests/test-largefiles-misc.t
+++ b/tests/test-largefiles-misc.t
@@ -227,15 +227,16 @@  verify that large files in subrepos hand
   M .hgsubstate
 # No differences
   $ hg st -S
+  A subrepo/large.txt
   $ hg sum
   parent: 2:ce4cd0c527a6 tip
    commit top repo
   branch: default
-  commit: (clean)
+  commit: 1 subrepos
   update: (current)
   $ echo "rev 2" > subrepo/large.txt
   $ hg st -S
-  M subrepo/large.txt
+  A subrepo/large.txt
   $ hg sum
   parent: 2:ce4cd0c527a6 tip
    commit top repo
@@ -257,11 +258,13 @@  Lock in subrepo, otherwise the change is
   $ hg ci -S -m "add normal file to top level"
   committing subrepository subrepo
   Invoking status precommit hook
-  M large.txt
+  A large.txt
   A normal.txt
   Invoking status precommit hook
   M .hgsubstate
   $ hg archive -S ../lf_subrepo_archive
+  abort: largefile large.txt not found in repo store or system cache
+  [255]
   $ find ../lf_subrepo_archive | sort
   ../lf_subrepo_archive
   ../lf_subrepo_archive/.hg_archival.txt
@@ -275,27 +278,28 @@  Lock in subrepo, otherwise the change is
   ../lf_subrepo_archive/a/b/c/d/e.normal.txt
   ../lf_subrepo_archive/a/b/c/x
   ../lf_subrepo_archive/a/b/c/x/y.normal.txt
-  ../lf_subrepo_archive/subrepo
-  ../lf_subrepo_archive/subrepo/large.txt
-  ../lf_subrepo_archive/subrepo/normal.txt
 
 Test update with subrepos.
 
   $ hg update 0
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  local changed .hgsubstate which remote deleted
+  use (c)hanged version or (d)elete? c
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg status -S
+  A .hgsubstate
   $ hg update tip
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status -S
+  A subrepo/large.txt
 # modify a large file
   $ echo "modified" > subrepo/large.txt
   $ hg st -S
-  M subrepo/large.txt
+  A subrepo/large.txt
 # update -C should revert the change.
   $ hg update -C
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status -S
-  M subrepo/large.txt
+  A subrepo/large.txt
 
 Test archiving a revision that references a subrepo that is not yet
 cloned (see test-subrepo-recursion.t):
@@ -304,6 +308,9 @@  cloned (see test-subrepo-recursion.t):
   $ cd ../empty
   $ hg archive --subrepos -r tip ../archive.tar.gz
   cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo
+  large.txt: largefile 8046cfb2d723576ac7438e131696328358a3b052 not available from file://$TESTTMP/statusmatch/subrepo
+  abort: largefile large.txt not found in repo store or system cache
+  [255]
   $ cd ..
 
 
@@ -357,11 +364,15 @@  Test actions on largefiles using relativ
   $ hg add --large anotherlarge
   $ hg st
   A sub/anotherlarge
+  R large2.dat
+  ? large2.dat
   $ hg st anotherlarge
   A anotherlarge
   $ hg commit -m anotherlarge anotherlarge
   Invoking status precommit hook
   A sub/anotherlarge
+  R large2.dat
+  ? large2.dat
   $ hg log anotherlarge
   changeset:   1:9627a577c5e9
   tag:         tip
@@ -383,6 +394,8 @@  Test actions on largefiles using relativ
   anotherlarge
   $ hg revert anotherlarge
   $ hg st
+  R large2.dat
+  ? large2.dat
   ? sub/anotherlarge.orig
   $ cd ..
 
diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t
--- a/tests/test-largefiles-update.t
+++ b/tests/test-largefiles-update.t
@@ -201,49 +201,39 @@  automated commit like rebase/transplant
   $ hg commit -m '#4'
 
   $ hg rebase -s 1 -d 2 --keep
-  abort: No such file or directory: '$TESTTMP/repo/large1'
+  $ hg status -A large1
+  large1: No such file or directory
+  $ hg status -A largeX
+  C largeX
+  $ hg strip -q 5
+
+  $ hg update -q -C 2
+  $ hg transplant -q 1 4
+  abort: file ".hglf/large1" is a largefile standin
+  (commit the largefile itself instead)
   [255]
   $ hg status -A large1
   large1: No such file or directory
   $ hg status -A largeX
-  M largeX
+  ? largeX
   $ hg strip -q 5
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  abort: unknown revision '5'!
   [255]
 
   $ hg update -q -C 2
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
-  $ hg transplant -q 1 4
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  $ hg transplant -q --merge 1 --merge 4
+  patching file .hglf/large1
+  Hunk #1 FAILED at 0
+  1 out of 1 hunks FAILED -- saving rejects to file .hglf/large1.rej
+  patch failed to apply
+  abort: fix up the merge and run hg transplant --continue
   [255]
   $ hg status -A large1
-  large1: No such file or directory
+  C large1
   $ hg status -A largeX
-  M largeX
+  ? largeX
   $ hg strip -q 5
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
-
-  $ hg update -q -C 2
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
-  $ hg transplant -q --merge 1 --merge 4
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
-  $ hg status -A large1
-  large1: No such file or directory
-  $ hg status -A largeX
-  M largeX
-  $ hg strip -q 5
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  abort: local changes found
   [255]
 
 Test that linear merge can detect modification (and conflict) correctly
@@ -252,8 +242,8 @@  Test that linear merge can detect modifi
 
   $ echo 'large2 for linear merge (no conflict)' > large2
   $ hg update 3 --config debug.dirstate.delaywrite=2
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  abort: uncommitted changes
+  (commit or update --clean to discard changes)
   [255]
   $ hg status -A large2
   M large2
@@ -265,75 +255,60 @@  Test that linear merge can detect modifi
 (linear merge with conflict, choosing "other")
 
   $ hg update -q -C 2
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
   $ echo 'large1 for linear merge (conflict)' > large1
   $ hg update 3 --config ui.interactive=True <<EOF
   > o
   > EOF
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
+  largefile large1 has a merge conflict
+  ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
+  keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
+  take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  getting changed largefiles
+  1 largefiles updated, 0 removed
   $ hg status -A large1
-  ? large1
+  C large1
   $ cat large1
-  large1 for linear merge (conflict)
+  large1 in #3
   $ cat .hglf/large1
-  58e24f733a964da346e2407a2bee99d9001184f5
+  e5bb990443d6a92aaf7223813720f7566c9dd05b
 
 (linear merge with conflict, choosing "local")
 
   $ hg update -q -C 2
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
   $ echo 'large1 for linear merge (conflict)' > large1
   $ hg update 3 --config debug.dirstate.delaywrite=2
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
+  largefile large1 has a merge conflict
+  ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
+  keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
+  take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
+  1 files updated, 1 files merged, 0 files removed, 0 files unresolved
   $ hg status -A large1
-  ? large1
+  M large1
   $ cat large1
   large1 for linear merge (conflict)
   $ cat .hglf/large1
-  58e24f733a964da346e2407a2bee99d9001184f5
+  ba94c2efe5b7c5e0af8d189295ce00553b0612b7
 
 Test a linear merge to a revision containing same-name normal file
 
   $ hg update -q -C 3
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
   $ hg remove large2
-  not removing large2: file is modified (use -f to force removal)
-  [1]
   $ echo 'large2 as normal file' > large2
   $ hg add large2
-  large2 already a largefile
   $ echo 'large3 as normal file' > large3
   $ hg add large3
   $ hg commit -m '#5'
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
   $ hg manifest
   .hglf/large1
-  .hglf/large2
+  large2
+  large3
   normal1
 
 (modified largefile is already switched to normal)
 
   $ hg update -q -C 2
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
   $ echo 'modified large2 for linear merge' > large2
   $ hg update -q 5
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
   $ hg debugdirstate --nodates | grep large2
   n 644         41 .hglf/large2
   $ hg status -A large2
@@ -344,18 +319,11 @@  Test a linear merge to a revision contai
 (added largefile is already committed as normal)
 
   $ hg update -q -C 2
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
   $ echo 'large3 as large file for linear merge' > large3
   $ hg add --large large3
-  large3 already tracked!
   $ hg update -q 5
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
   $ hg debugdirstate --nodates | grep large3
-  a   0         -1 large3
+  a   0         -1 .hglf/large3
   $ hg status -A large3
   A large3
   $ cat large3
@@ -366,11 +334,8 @@  Test that the internal linear merging wo
 (both heads are stripped to keep pairing of revision number and commit log)
 
   $ hg update -q -C 2
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
   $ hg strip 3 4
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9530e27857f7-backup.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9530e27857f7-backup.hg
   $ mv .hg/strip-backup/9530e27857f7-backup.hg $TESTTMP
 
 (internal linear merging at "hg pull --update")
@@ -383,18 +348,25 @@  Test that the internal linear merging wo
   adding changesets
   adding manifests
   adding file changes
-  added 2 changesets with 3 changes to 3 files (+1 heads)
-  not updating: uncommitted changes
-  (commit and merge, or update --clean to discard changes)
+  added 3 changesets with 5 changes to 5 files (+2 heads)
+  local changed .hglf/large2 which remote deleted
+  use (c)hanged version or (d)elete? c
+  remote turned local largefile large2 into a normal file
+  keep (l)argefile or use (n)ormal file? l
+  largefile large1 has a merge conflict
+  ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
+  keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
+  take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
+  2 files updated, 1 files merged, 0 files removed, 0 files unresolved
 
   $ hg status -A large1
-  ? large1
+  M large1
   $ cat large1
   large1 for linear merge (conflict)
   $ cat .hglf/large1
-  58e24f733a964da346e2407a2bee99d9001184f5
+  ba94c2efe5b7c5e0af8d189295ce00553b0612b7
   $ hg status -A large2
-  M large2
+  A large2
   $ cat large2
   large2 for linear merge (conflict with normal file)
   $ cat .hglf/large2
@@ -403,9 +375,6 @@  Test that the internal linear merging wo
 (internal linear merging at "hg unbundle --update")
 
   $ hg update -q -C 2
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
   $ hg rollback -q
 
   $ echo 'large1 for linear merge (conflict)' > large1
@@ -414,22 +383,23 @@  Test that the internal linear merging wo
   adding changesets
   adding manifests
   adding file changes
-  added 2 changesets with 3 changes to 3 files (+1 heads)
-  not updating: uncommitted changes
-  (commit and merge, or update --clean to discard changes)
+  added 3 changesets with 5 changes to 5 files (+2 heads)
+  4 files updated, 0 files merged, 1 files removed, 0 files unresolved
 
   $ hg status -A large1
-  ? large1
+  M large1
   $ cat large1
   large1 for linear merge (conflict)
   $ cat .hglf/large1
-  58e24f733a964da346e2407a2bee99d9001184f5
+  e5bb990443d6a92aaf7223813720f7566c9dd05b
   $ hg status -A large2
   M large2
+  C large2
   $ cat large2
-  large2 for linear merge (conflict with normal file)
+  large2 as normal file
   $ cat .hglf/large2
-  d7591fe9be0f6227d90bddf3e4f52ff41fc1f544
+  cat: .hglf/large2: No such file or directory
+  [1]
 
 (internal linear merging in subrepo at "hg update")
 
@@ -446,14 +416,9 @@  Test that the internal linear merging wo
   $ cat .hgsubstate
   f74e50bd9e5594b7cf1e6c5cbab86ddd25f3ca2f sub
   $ hg -R sub update -q
-  abort: not a linear update
-  (merge or update --check to force update)
-  [255]
   $ hg commit -m '#1@parent'
-  nothing changed
-  [1]
   $ cat .hgsubstate
-  f74e50bd9e5594b7cf1e6c5cbab86ddd25f3ca2f sub
+  d65e59e952a9638e2ce863b41a420ca723dd3e8d sub
   $ hg update -q 0
 
   $ echo 'large1 for linear merge (conflict)' > sub/large1
@@ -465,6 +430,10 @@  Test that the internal linear merging wo
   > l
   > l
   > EOF
+   subrepository sub diverged (local revision: f74e50bd9e55, remote revision: d65e59e952a9)
+  (M)erge, keep (l)ocal or keep (r)emote?  subrepository sources for sub differ (in checked out version)
+  use (l)ocal source (f74e50bd9e55) or (r)emote source (d65e59e952a9)?
+   4 files updated, 0 files merged, 1 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ hg -R sub status -A sub/large1
@@ -472,13 +441,14 @@  Test that the internal linear merging wo
   $ cat sub/large1
   large1 for linear merge (conflict)
   $ cat sub/.hglf/large1
-  4669e532d5b2c093a78eca010077e708a071bb64
+  e5bb990443d6a92aaf7223813720f7566c9dd05b
   $ hg -R sub status -A sub/large2
-  M sub/large2
+  C sub/large2
   $ cat sub/large2
-  large2 for linear merge (conflict with normal file)
+  large2 as normal file
   $ cat sub/.hglf/large2
-  3cfce6277e7668985707b6887ce56f9f62f6ccd9
+  cat: sub/.hglf/large2: No such file or directory
+  [1]
 
   $ cd ..
   $ cd repo
@@ -487,26 +457,23 @@  Test that rebase updates largefiles in t
 it is aborted by conflict.
 
   $ hg update -q -C 3
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
-  [255]
   $ cat .hglf/large1
-  58e24f733a964da346e2407a2bee99d9001184f5
+  4669e532d5b2c093a78eca010077e708a071bb64
   $ cat large1
-  large1 for linear merge (conflict)
+  large1
   $ hg rebase -s 1 -d 3 --keep --config ui.interactive=True <<EOF
   > o
   > EOF
-  abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  abort: source is ancestor of destination
   [255]
   $ cat .hglf/large1
-  58e24f733a964da346e2407a2bee99d9001184f5
+  4669e532d5b2c093a78eca010077e708a071bb64
   $ cat large1
-  large1 for linear merge (conflict)
+  large1
 
   $ hg rebase -q --abort
-  rebase aborted
+  abort: no rebase in progress
+  [255]
 
 Test that transplant updates largefiles, of which standins are safely
 changed, even if it is aborted by conflict of other.
@@ -516,7 +483,8 @@  changed, even if it is aborted by confli
   cat: .hglf/large1: No such file or directory
   [1]
   $ cat large1
-  large1 for linear merge (conflict)
+  cat: large1: No such file or directory
+  [1]
   $ hg diff -c 4 .hglf/largeX | grep '^[+-][0-9a-z]'
   [1]
   $ hg transplant 4
@@ -530,12 +498,13 @@  changed, even if it is aborted by confli
   abort: fix up the merge and run hg transplant --continue
   [255]
   $ hg status -A large1
-  ? large1
+  large1: No such file or directory
   $ cat .hglf/large1
   cat: .hglf/large1: No such file or directory
   [1]
   $ cat large1
-  large1 for linear merge (conflict)
+  cat: large1: No such file or directory
+  [1]
   $ hg status -A largeX
   C largeX
   $ cat .hglf/largeX
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -370,7 +370,6 @@  Committing directories containing only l
   A z/y/x/m/large1
   A z/y/x/m/normal
   $ hg st
-  M large3
   A large5
   A sub2/large6
   A sub2/large7
@@ -385,7 +384,6 @@  Committing directories containing only l
   A sub2/large7
   A z/y/x/m/normal
   $ hg st
-  M large3
   A large5
   A sub2/large6
   A sub2/large7
@@ -618,6 +616,7 @@  Test commit -A (issue3542)
   Invoking status precommit hook
   R large8
   Invoking status postcommit hook
+  R large8
   C normal
   C normal3
   C sub/large4
@@ -632,6 +631,7 @@  Test that a standin can't be added as a 
   $ hg ci -m "add"
   Invoking status precommit hook
   A large
+  R large8
   Invoking status postcommit hook
   C large
   C normal
@@ -1178,12 +1178,11 @@  rebased or not.
   M sub2/large6
   saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg
   0 largefiles cached
-  getting changed largefiles
-  1 largefiles updated, 0 removed
   nothing to rebase - working directory parent is also destination
   $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
+  [1]
   $ hg log --template '{rev}:{node|short}  {desc|firstline}\n'
-  9:598410d3eb9a  modify normal file largefile in repo d
+  9:4bb74f99b6e6  modify normal file largefile in repo d
   8:a381d2c8c80e  modify normal file and largefile in repo b
   7:daea875e9014  add/edit more largefiles
   6:4355d653f84f  edit files yet again
@@ -1194,7 +1193,7 @@  rebased or not.
   1:ce8896473775  edit files
   0:30d30fe6a5be  add files
   $ hg log -G --template '{rev}:{node|short}  {desc|firstline}\n'
-  @  9:598410d3eb9a  modify normal file largefile in repo d
+  @  9:4bb74f99b6e6  modify normal file largefile in repo d
   |
   o  8:a381d2c8c80e  modify normal file and largefile in repo b
   |
@@ -1219,7 +1218,7 @@  rebased or not.
   $ cat sub/normal4
   normal4-modified
   $ cat sub/large4
-  large4-modified
+  large44
   $ cat sub2/large6
   large6-modified
   $ cat sub2/large7
@@ -1515,10 +1514,14 @@  revert some files to an older revision
   checking files
   10 files, 10 changesets, 28 total revisions
   searching 1 changesets for largefiles
+  changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
   verified existence of 3 revisions of 3 largefiles
+  [1]
 
 - introduce missing blob in local store repo and make sure that this is caught:
   $ mv $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 .
+  mv: cannot stat '$TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928': No such file or directory
+  [1]
   $ hg verify --large
   checking changesets
   checking manifests
@@ -1538,6 +1541,8 @@  revert some files to an older revision
 
 - cleanup
   $ mv e166e74c7303192238d60af5a9c4ce9bef0b7928 $TESTTMP/d/.hg/largefiles/
+  mv: cannot stat 'e166e74c7303192238d60af5a9c4ce9bef0b7928': No such file or directory
+  [1]
 
 - verifying all revisions will fail because we didn't clone all largefiles to d:
   $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
@@ -1549,9 +1554,10 @@  revert some files to an older revision
   changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
   changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
   changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
-  changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c (glob)
-  changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9 (glob)
-  changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0 (glob)
+  changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c
+  changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9
+  changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0
+  changeset 8:a381d2c8c80e: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
   [1]
 
 - cleanup
@@ -1600,7 +1606,7 @@  Merge with revision with missing largefi
   $ hg ci -Am branch
   adding f
   Invoking status precommit hook
-  A f
+  ? f
   created new head
   $ hg merge -r 6
   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -1617,7 +1623,12 @@  Pulling 0 revisions with --all-largefile
   $ hg pull --all-largefiles
   pulling from $TESTTMP/d (glob)
   searching for changes
-  no changes found
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 3 files (+1 heads)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+  0 largefiles cached
 
 Merging does not revert to old versions of largefiles and also check
 that merging after having pulled from a non-default remote works
@@ -1653,31 +1664,24 @@  correctly.
   adding changesets
   adding manifests
   adding file changes
-  added 2 changesets with 4 changes to 4 files (+1 heads)
+  added 3 changesets with 5 changes to 4 files (+2 heads)
   (run 'hg heads' to see heads, 'hg merge' to merge)
   2 largefiles cached
   $ hg merge
-  largefile sub/large4 has a merge conflict
-  ancestor was 971fb41e78fea4f8e0ba5244784239371cb00591
-  keep (l)ocal d846f26643bfa8ec210be40cc93cc6b7ff1128ea or
-  take (o)ther e166e74c7303192238d60af5a9c4ce9bef0b7928? l
-  3 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  (branch merge, don't forget to commit)
-  getting changed largefiles
-  1 largefiles updated, 0 removed
+  abort: branch 'default' has 3 heads - please merge with an explicit rev
+  (run 'hg heads .' to see heads)
+  [255]
   $ hg commit -m "Merge repos e and f"
-  Invoking status precommit hook
-  M normal3
-  M sub/normal4
-  M sub2/large6
+  nothing changed
+  [1]
   $ cat normal3
-  normal3-modified
+  normal33
   $ cat sub/normal4
-  normal4-modified
+  normal44
   $ cat sub/large4
   large4-merge-test
   $ cat sub2/large6
-  large6-modified
+  large6
   $ cat sub2/large7
   large7
 
@@ -1695,22 +1699,18 @@  Test status after merging with a branch 
   M normal3
   created new head
   $ hg merge
-  1 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
+  abort: branch 'default' has 4 heads - please merge with an explicit rev
+  (run 'hg heads .' to see heads)
+  [255]
   $ hg status
-  M large
 
 - make sure update of merge with removed largefiles fails as expected
   $ hg rm sub2/large6
   $ hg up -r.
-  abort: outstanding uncommitted merges
-  [255]
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 - revert should be able to revert files introduced in a pending merge
   $ hg revert --all -r .
-  removing .hglf/large
   undeleting .hglf/sub2/large6
 
 Test that a normal file and a largefile with the same name and path cannot
@@ -1736,15 +1736,9 @@  Test that transplanting a largefile chan
   $ cd g
   $ hg transplant -s ../d 598410d3eb9a
   searching for changes
-  searching for changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 1 changesets with 2 changes to 2 files
-  getting changed largefiles
-  1 largefiles updated, 0 removed
+  abort: unknown revision '598410d3eb9a'!
+  [255]
   $ hg log --template '{rev}:{node|short}  {desc|firstline}\n'
-  9:598410d3eb9a  modify normal file largefile in repo d
   8:a381d2c8c80e  modify normal file and largefile in repo b
   7:daea875e9014  add/edit more largefiles
   6:4355d653f84f  edit files yet again
@@ -1757,11 +1751,11 @@  Test that transplanting a largefile chan
   $ cat normal3
   normal3-modified
   $ cat sub/normal4
-  normal4-modified
+  normal44
   $ cat sub/large4
   large4-modified
   $ cat sub2/large6
-  large6-modified
+  large6
   $ cat sub2/large7
   large7
 
@@ -1772,25 +1766,27 @@  Cat a largefile
   large4-modified
   $ rm "${USERCACHE}"/*
   $ hg cat -r a381d2c8c80e -o cat.out sub/large4
+  sub/large4: data corruption (expected e166e74c7303192238d60af5a9c4ce9bef0b7928, got 1f19b76d5b3cad1472c87efb42b582c97e040060)
+  abort: largefile sub/large4 is not in cache and could not be downloaded
+  [255]
   $ cat cat.out
-  large4-modified
   $ rm cat.out
   $ hg cat -r a381d2c8c80e normal3
   normal3-modified
   $ hg cat -r '.^' normal3
-  normal3-modified
+  normal33
   $ hg cat -r '.^' sub/large4 doesntexist
-  large4-modified
-  doesntexist: no such file in rev a381d2c8c80e
+  large44
+  doesntexist: no such file in rev daea875e9014
   $ hg --cwd sub cat -r '.^' large4
-  large4-modified
+  large44
   $ hg --cwd sub cat -r '.^' ../normal3
-  normal3-modified
+  normal33
 Cat a standin
   $ hg cat .hglf/sub/large4
   e166e74c7303192238d60af5a9c4ce9bef0b7928
   $ hg cat .hglf/normal3
-  .hglf/normal3: no such file in rev 598410d3eb9a
+  .hglf/normal3: no such file in rev a381d2c8c80e
   [1]
 
 Test that renaming a largefile results in correct output for status