189 '''Returns true if path matches [keyword] pattern |
189 '''Returns true if path matches [keyword] pattern |
190 and is not a symbolic link. |
190 and is not a symbolic link. |
191 Caveat: localrepository._link fails on Windows.''' |
191 Caveat: localrepository._link fails on Windows.''' |
192 return self.match(path) and not 'l' in flagfunc(path) |
192 return self.match(path) and not 'l' in flagfunc(path) |
193 |
193 |
194 def overwrite(self, ctx, candidates, iswctx, expand, cfiles): |
194 def overwrite(self, ctx, candidates, iswctx, expand, changed): |
195 '''Overwrites selected files expanding/shrinking keywords.''' |
195 '''Overwrites selected files expanding/shrinking keywords.''' |
196 if cfiles is not None: |
196 if changed is not None: |
197 candidates = [f for f in candidates if f in cfiles] |
197 candidates = [f for f in candidates if f in changed] |
198 candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)] |
198 candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)] |
199 if candidates: |
199 if candidates: |
200 restrict = self.restrict |
200 restrict = self.restrict |
201 self.restrict = True # do not expand when reading |
201 self.restrict = True # do not expand when reading |
202 rollback = kwtools['hgcmd'] == 'rollback' |
202 rollback = kwtools['hgcmd'] == 'rollback' |
508 |
508 |
509 def rollback(self, dryrun=False): |
509 def rollback(self, dryrun=False): |
510 wlock = repo.wlock() |
510 wlock = repo.wlock() |
511 try: |
511 try: |
512 if not dryrun: |
512 if not dryrun: |
513 cfiles = self['.'].files() |
513 changed = self['.'].files() |
514 ret = super(kwrepo, self).rollback(dryrun) |
514 ret = super(kwrepo, self).rollback(dryrun) |
515 if not dryrun: |
515 if not dryrun: |
516 ctx = self['.'] |
516 ctx = self['.'] |
517 modified, added = super(kwrepo, self).status()[:2] |
517 modified, added = super(kwrepo, self).status()[:2] |
518 kwt.overwrite(ctx, added, True, False, cfiles) |
518 kwt.overwrite(ctx, added, True, False, changed) |
519 kwt.overwrite(ctx, modified, True, True, cfiles) |
519 kwt.overwrite(ctx, modified, True, True, changed) |
520 return ret |
520 return ret |
521 finally: |
521 finally: |
522 wlock.release() |
522 wlock.release() |
523 |
523 |
524 # monkeypatches |
524 # monkeypatches |