##// 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 Depending on subfunc also returns number of substitutions.'''
141 Depending on subfunc also returns number of substitutions.'''
142 return subfunc(r'$\1$', text)
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 class kwtemplater(object):
154 class kwtemplater(object):
146 '''
155 '''
@@ -509,18 +518,16 b' def reposetup(ui, repo):'
509 return n
518 return n
510
519
511 def rollback(self, dryrun=False):
520 def rollback(self, dryrun=False):
512 wlock = repo.wlock()
521 wlock = self.wlock()
513 try:
522 try:
514 if not dryrun:
523 if not dryrun:
515 changed = self['.'].files()
524 changed = self['.'].files()
516 ret = super(kwrepo, self).rollback(dryrun)
525 ret = super(kwrepo, self).rollback(dryrun)
517 if not dryrun:
526 if not dryrun:
518 ctx = self['.']
527 ctx = self['.']
519 modified, added = self[None].status()[:2]
528 modified, added = _preselect(self[None].status(), changed)
520 modified = [f for f in modified if f in changed]
529 kwt.overwrite(ctx, modified, True, True)
521 added = [f for f in added if f in changed]
522 kwt.overwrite(ctx, added, True, False)
530 kwt.overwrite(ctx, added, True, False)
523 kwt.overwrite(ctx, modified, True, True)
524 return ret
531 return ret
525 finally:
532 finally:
526 wlock.release()
533 wlock.release()
@@ -569,13 +576,11 b' def reposetup(ui, repo):'
569 # therefore compare nodes before and after
576 # therefore compare nodes before and after
570 kwt.record = True
577 kwt.record = True
571 ctx = repo['.']
578 ctx = repo['.']
572 modified, added = repo[None].status()[:2]
579 wstatus = repo[None].status()
573 ret = orig(ui, repo, commitfunc, *pats, **opts)
580 ret = orig(ui, repo, commitfunc, *pats, **opts)
574 recctx = repo['.']
581 recctx = repo['.']
575 if ctx != recctx:
582 if ctx != recctx:
576 changed = recctx.files()
583 modified, added = _preselect(wstatus, recctx.files())
577 modified = [f for f in modified if f in changed]
578 added = [f for f in added if f in changed]
579 kwt.restrict = False
584 kwt.restrict = False
580 kwt.overwrite(recctx, modified, False, True)
585 kwt.overwrite(recctx, modified, False, True)
581 kwt.overwrite(recctx, added, False, True, True)
586 kwt.overwrite(recctx, added, False, True, True)
General Comments 0
You need to be logged in to leave comments. Login now