##// END OF EJS Templates
keyword: code cleanup...
Christian Ebert -
r12723:eaa09d25 default
parent child Browse files
Show More
@@ -141,6 +141,15 b' def _shrinktext(text, subfunc):'
141 141 Depending on subfunc also returns number of substitutions.'''
142 142 return subfunc(r'$\1$', text)
143 143
144 def _preselect(wstatus, changed):
145 '''Retrieves modfied and added files from a working directory state
146 and returns the subset of each contained in given changed files
147 retrieved from a change context.'''
148 modified, added = wstatus[:2]
149 modified = [f for f in modified if f in changed]
150 added = [f for f in added if f in changed]
151 return modified, added
152
144 153
145 154 class kwtemplater(object):
146 155 '''
@@ -509,18 +518,16 b' def reposetup(ui, repo):'
509 518 return n
510 519
511 520 def rollback(self, dryrun=False):
512 wlock = repo.wlock()
521 wlock = self.wlock()
513 522 try:
514 523 if not dryrun:
515 524 changed = self['.'].files()
516 525 ret = super(kwrepo, self).rollback(dryrun)
517 526 if not dryrun:
518 527 ctx = self['.']
519 modified, added = self[None].status()[:2]
520 modified = [f for f in modified if f in changed]
521 added = [f for f in added if f in changed]
528 modified, added = _preselect(self[None].status(), changed)
529 kwt.overwrite(ctx, modified, True, True)
522 530 kwt.overwrite(ctx, added, True, False)
523 kwt.overwrite(ctx, modified, True, True)
524 531 return ret
525 532 finally:
526 533 wlock.release()
@@ -569,13 +576,11 b' def reposetup(ui, repo):'
569 576 # therefore compare nodes before and after
570 577 kwt.record = True
571 578 ctx = repo['.']
572 modified, added = repo[None].status()[:2]
579 wstatus = repo[None].status()
573 580 ret = orig(ui, repo, commitfunc, *pats, **opts)
574 581 recctx = repo['.']
575 582 if ctx != recctx:
576 changed = recctx.files()
577 modified = [f for f in modified if f in changed]
578 added = [f for f in added if f in changed]
583 modified, added = _preselect(wstatus, recctx.files())
579 584 kwt.restrict = False
580 585 kwt.overwrite(recctx, modified, False, True)
581 586 kwt.overwrite(recctx, added, False, True, True)
General Comments 0
You need to be logged in to leave comments. Login now