largefiles: don't prompt for normal/largefile changes when doing plain updates

We used to get like:

  $ hg up -r 2
  foo has been turned into a normal file
  keep as (l)argefile or use (n)ormal file? l
  getting changed largefiles
  0 largefiles updated, 0 removed
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
  $ cat foo
  cat: foo: No such file or directory
  [1]

- which both asked the wrong question and did the wrong thing.

Instead, skip this conflict resolution when the local conflicting file has been
scheduled for removal and there thus is no conflict.
This commit is contained in:
Mads Kiilerich 2013-10-25 02:33:59 +08:00
parent d2031cc679
commit bcec8229ea
2 changed files with 31 additions and 2 deletions

View File

@ -374,6 +374,7 @@ def overridemanifestmerge(origfn, repo, p1, p2, pa, branchmerge, force,
if overwrite:
return actions
removes = set(a[0] for a in actions if a[1] == 'r')
processed = []
for action in actions:
@ -381,7 +382,7 @@ def overridemanifestmerge(origfn, repo, p1, p2, pa, branchmerge, force,
splitstandin = lfutil.splitstandin(f)
if (m == "g" and splitstandin is not None and
splitstandin in p1):
splitstandin in p1 and splitstandin not in removes):
# Case 1: normal file in the working copy, largefile in
# the second parent
lfile = splitstandin
@ -394,7 +395,8 @@ def overridemanifestmerge(origfn, repo, p1, p2, pa, branchmerge, force,
processed.append((standin, "g", (p2.flags(standin),), msg))
else:
processed.append((standin, "r", None, msg))
elif m == "g" and lfutil.standin(f) in p1:
elif (m == "g" and
lfutil.standin(f) in p1 and lfutil.standin(f) not in removes):
# Case 2: largefile in the working copy, normal file in
# the second parent
standin = lfutil.standin(f)

View File

@ -109,4 +109,31 @@ Largefile in the working copy, keeping the largefile version:
$ cat foo
large
Whatever ... commit something so we can invoke merge when updating
$ hg commit -m '3: Merge'
Updating from largefile to normal - no reason to prompt
$ hg up -r 2
getting changed largefiles
0 largefiles updated, 0 removed
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ cat foo
normal
(the update above used to leave the working dir in a very weird state - clean it
$ hg up -qr null
$ hg up -qr 2
)
Updating from normal to largefile - no reason to prompt
$ hg up -r 3
getting changed largefiles
1 largefiles updated, 0 removed
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ cat foo
large
$ cd ..