Mercurial > hg
comparison hgext/keyword.py @ 6505:7ae26bb2d5cc
keyword: make overwrite() arguments mandatory
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Wed, 09 Apr 2008 14:05:57 +0200 |
parents | 1be53f931c9c |
children | 850071c017fa |
comparison
equal
deleted
inserted
replaced
6504:1be53f931c9c | 6505:7ae26bb2d5cc |
---|---|
167 '''Returns true if path matches [keyword] pattern | 167 '''Returns true if path matches [keyword] pattern |
168 and is not a symbolic link. | 168 and is not a symbolic link. |
169 Caveat: localrepository._link fails on Windows.''' | 169 Caveat: localrepository._link fails on Windows.''' |
170 return self.matcher(path) and not islink(path) | 170 return self.matcher(path) and not islink(path) |
171 | 171 |
172 def overwrite(self, node=None, expand=True, files=None): | 172 def overwrite(self, node, expand, files): |
173 '''Overwrites selected files expanding/shrinking keywords.''' | 173 '''Overwrites selected files expanding/shrinking keywords.''' |
174 ctx = self.repo.changectx(node) | 174 ctx = self.repo.changectx(node) |
175 mf = ctx.manifest() | 175 mf = ctx.manifest() |
176 if node is not None: # commit | 176 if node is not None: # commit |
177 files = [f for f in ctx.files() if f in mf] | 177 files = [f for f in ctx.files() if f in mf] |
270 raise util.Abort(_('outstanding uncommitted changes in given files')) | 270 raise util.Abort(_('outstanding uncommitted changes in given files')) |
271 wlock = lock = None | 271 wlock = lock = None |
272 try: | 272 try: |
273 wlock = repo.wlock() | 273 wlock = repo.wlock() |
274 lock = repo.lock() | 274 lock = repo.lock() |
275 kwt.overwrite(expand=expand, files=clean) | 275 kwt.overwrite(None, expand, clean) |
276 finally: | 276 finally: |
277 del wlock, lock | 277 del wlock, lock |
278 | 278 |
279 | 279 |
280 def demo(ui, repo, *args, **opts): | 280 def demo(ui, repo, *args, **opts): |
487 | 487 |
488 # restore commit hooks | 488 # restore commit hooks |
489 for name, cmd in commithooks.iteritems(): | 489 for name, cmd in commithooks.iteritems(): |
490 ui.setconfig('hooks', name, cmd) | 490 ui.setconfig('hooks', name, cmd) |
491 if n is not None: | 491 if n is not None: |
492 kwt.overwrite(node=n) | 492 kwt.overwrite(n, True, None) |
493 repo.hook('commit', node=n, parent1=_p1, parent2=_p2) | 493 repo.hook('commit', node=n, parent1=_p1, parent2=_p2) |
494 return n | 494 return n |
495 finally: | 495 finally: |
496 del wlock, lock | 496 del wlock, lock |
497 | 497 |