6 # This software may be used and distributed according to the terms of the |
6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. |
7 # GNU General Public License version 2 or any later version. |
8 |
8 |
9 '''High-level command function for lfconvert, plus the cmdtable.''' |
9 '''High-level command function for lfconvert, plus the cmdtable.''' |
10 |
10 |
11 import os |
11 import os, errno |
12 import shutil |
12 import shutil |
13 |
13 |
14 from mercurial import util, match as match_, hg, node, context, error, \ |
14 from mercurial import util, match as match_, hg, node, context, error, \ |
15 cmdutil, scmutil, commands |
15 cmdutil, scmutil, commands |
16 from mercurial.i18n import _ |
16 from mercurial.i18n import _ |
401 if filelist: |
401 if filelist: |
402 lfiles = set(lfiles) & set(filelist) |
402 lfiles = set(lfiles) & set(filelist) |
403 toget = [] |
403 toget = [] |
404 |
404 |
405 for lfile in lfiles: |
405 for lfile in lfiles: |
406 # If we are mid-merge, then we have to trust the standin that is in the |
406 try: |
407 # working copy to have the correct hashvalue. This is because the |
|
408 # original hg.merge() already updated the standin as part of the normal |
|
409 # merge process -- we just have to update the largefile to match. |
|
410 if (getattr(repo, "_ismerging", False) and |
|
411 os.path.exists(repo.wjoin(lfutil.standin(lfile)))): |
|
412 expectedhash = lfutil.readstandin(repo, lfile) |
|
413 else: |
|
414 expectedhash = repo[node][lfutil.standin(lfile)].data().strip() |
407 expectedhash = repo[node][lfutil.standin(lfile)].data().strip() |
415 |
408 except IOError, err: |
416 # if it exists and its hash matches, it might have been locally |
409 if err.errno == errno.ENOENT: |
417 # modified before updating and the user chose 'local'. in this case, |
410 continue # node must be None and standin wasn't found in wctx |
418 # it will not be in any store, so don't look for it. |
411 raise |
419 if ((not os.path.exists(repo.wjoin(lfile)) or |
412 if not lfutil.findfile(repo, expectedhash): |
420 expectedhash != lfutil.hashfile(repo.wjoin(lfile))) and |
|
421 not lfutil.findfile(repo, expectedhash)): |
|
422 toget.append((lfile, expectedhash)) |
413 toget.append((lfile, expectedhash)) |
423 |
414 |
424 if toget: |
415 if toget: |
425 store = basestore._openstore(repo) |
416 store = basestore._openstore(repo) |
426 ret = store.get(toget) |
417 ret = store.get(toget) |