comparison hgext/largefiles/lfcommands.py @ 15255:7ab05d752405

largefiles: cosmetics, whitespace, code style This is mainly about keeping code under the 80-column limit with as few backslashes as possible. I am deliberately not making any logic or behaviour changes here and have restrained myself to a few "peephole" refactorings.
author Greg Ward <greg@gerg.ca>
date Thu, 13 Oct 2011 21:42:54 -0400
parents dd03d3a9f888
children 07811b3b119b
comparison
equal deleted inserted replaced
15254:dd03d3a9f888 15255:7ab05d752405
381 for lfile in lfiles: 381 for lfile in lfiles:
382 expectedhash = repo[node][lfutil.standin(lfile)].data().strip() 382 expectedhash = repo[node][lfutil.standin(lfile)].data().strip()
383 # if it exists and its hash matches, it might have been locally 383 # if it exists and its hash matches, it might have been locally
384 # modified before updating and the user chose 'local'. in this case, 384 # modified before updating and the user chose 'local'. in this case,
385 # it will not be in any store, so don't look for it. 385 # it will not be in any store, so don't look for it.
386 if (not os.path.exists(repo.wjoin(lfile)) \ 386 if ((not os.path.exists(repo.wjoin(lfile)) or
387 or expectedhash != lfutil.hashfile(repo.wjoin(lfile))) and \ 387 expectedhash != lfutil.hashfile(repo.wjoin(lfile))) and
388 not lfutil.findfile(repo, expectedhash): 388 not lfutil.findfile(repo, expectedhash)):
389 toget.append((lfile, expectedhash)) 389 toget.append((lfile, expectedhash))
390 390
391 if toget: 391 if toget:
392 store = basestore._openstore(repo) 392 store = basestore._openstore(repo)
393 ret = store.get(toget) 393 ret = store.get(toget)
439 absstandin = repo.wjoin(lfutil.standin(lfile)) 439 absstandin = repo.wjoin(lfutil.standin(lfile))
440 if os.path.exists(absstandin): 440 if os.path.exists(absstandin):
441 if os.path.exists(absstandin+'.orig'): 441 if os.path.exists(absstandin+'.orig'):
442 shutil.copyfile(abslfile, abslfile+'.orig') 442 shutil.copyfile(abslfile, abslfile+'.orig')
443 expecthash = lfutil.readstandin(repo, lfile) 443 expecthash = lfutil.readstandin(repo, lfile)
444 if expecthash != '' and \ 444 if (expecthash != '' and
445 (not os.path.exists(abslfile) or \ 445 (not os.path.exists(abslfile) or
446 expecthash != lfutil.hashfile(abslfile)): 446 expecthash != lfutil.hashfile(abslfile))):
447 if not lfutil.copyfromcache(repo, expecthash, lfile): 447 if not lfutil.copyfromcache(repo, expecthash, lfile):
448 return None # don't try to set the mode or update the dirstate 448 return None # don't try to set the mode or update the dirstate
449 ret = 1 449 ret = 1
450 mode = os.stat(absstandin).st_mode 450 mode = os.stat(absstandin).st_mode
451 if mode != os.stat(abslfile).st_mode: 451 if mode != os.stat(abslfile).st_mode:
466 lfdirstate.drop(lfile) 466 lfdirstate.drop(lfile)
467 return ret 467 return ret
468 468
469 # -- hg commands declarations ------------------------------------------------ 469 # -- hg commands declarations ------------------------------------------------
470 470
471
472 cmdtable = { 471 cmdtable = {
473 'lfconvert': (lfconvert, 472 'lfconvert': (lfconvert,
474 [('s', 'size', '', 473 [('s', 'size', '',
475 _('minimum size (MB) for files to be converted ' 474 _('minimum size (MB) for files to be converted '
476 'as largefiles'), 475 'as largefiles'),