comparison hgext/largefiles/lfcommands.py @ 22095:cb62d77c7a01

largefiles: factor out synchronization of lfdirstate for future use
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 11 Aug 2014 22:29:43 +0900
parents 0cb34b3991f8
children f72d73937853
comparison
equal deleted inserted replaced
22094:7d7065476fea 22095:cb62d77c7a01
508 os.chmod(abslfile, mode) 508 os.chmod(abslfile, mode)
509 update1 = 1 509 update1 = 1
510 510
511 updated += update1 511 updated += update1
512 512
513 standin = lfutil.standin(lfile) 513 lfutil.synclfdirstate(repo, lfdirstate, lfile, normallookup)
514 if standin in repo.dirstate:
515 stat = repo.dirstate._map[standin]
516 state, mtime = stat[0], stat[3]
517 else:
518 state, mtime = '?', -1
519 if state == 'n':
520 if normallookup or mtime < 0:
521 # state 'n' doesn't ensure 'clean' in this case
522 lfdirstate.normallookup(lfile)
523 else:
524 lfdirstate.normal(lfile)
525 elif state == 'm':
526 lfdirstate.normallookup(lfile)
527 elif state == 'r':
528 lfdirstate.remove(lfile)
529 elif state == 'a':
530 lfdirstate.add(lfile)
531 elif state == '?':
532 lfdirstate.drop(lfile)
533 514
534 lfdirstate.write() 515 lfdirstate.write()
535 if printmessage and lfiles: 516 if printmessage and lfiles:
536 ui.status(_('%d largefiles updated, %d removed\n') % (updated, 517 ui.status(_('%d largefiles updated, %d removed\n') % (updated,
537 removed)) 518 removed))