Mercurial > hg
comparison hgext/keyword.py @ 6760:4faaa0535ea7
status: clean up all users for unknown files
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 27 Jun 2008 13:43:29 -0500 |
parents | ed5ffb2c12f3 |
children | f67d1468ac50 |
comparison
equal
deleted
inserted
replaced
6759:9d2ab50803e9 | 6760:4faaa0535ea7 |
---|---|
251 if self.renamed(node): | 251 if self.renamed(node): |
252 t2 = super(kwfilelog, self).read(node) | 252 t2 = super(kwfilelog, self).read(node) |
253 return t2 != text | 253 return t2 != text |
254 return revlog.revlog.cmp(self, node, text) | 254 return revlog.revlog.cmp(self, node, text) |
255 | 255 |
256 def _status(ui, repo, kwt, *pats, **opts): | 256 def _status(ui, repo, kwt, unknown, *pats, **opts): |
257 '''Bails out if [keyword] configuration is not active. | 257 '''Bails out if [keyword] configuration is not active. |
258 Returns status of working directory.''' | 258 Returns status of working directory.''' |
259 if kwt: | 259 if kwt: |
260 matcher = cmdutil.match(repo, pats, opts) | 260 matcher = cmdutil.match(repo, pats, opts) |
261 return repo.status(match=matcher, clean=True) | 261 return repo.status(match=matcher, unknown=unknown, clean=True) |
262 if ui.configitems('keyword'): | 262 if ui.configitems('keyword'): |
263 raise util.Abort(_('[keyword] patterns cannot match')) | 263 raise util.Abort(_('[keyword] patterns cannot match')) |
264 raise util.Abort(_('no [keyword] patterns configured')) | 264 raise util.Abort(_('no [keyword] patterns configured')) |
265 | 265 |
266 def _kwfwrite(ui, repo, expand, *pats, **opts): | 266 def _kwfwrite(ui, repo, expand, *pats, **opts): |
267 '''Selects files and passes them to kwtemplater.overwrite.''' | 267 '''Selects files and passes them to kwtemplater.overwrite.''' |
268 if repo.dirstate.parents()[1] != nullid: | 268 if repo.dirstate.parents()[1] != nullid: |
269 raise util.Abort(_('outstanding uncommitted merge')) | 269 raise util.Abort(_('outstanding uncommitted merge')) |
270 kwt = kwtools['templater'] | 270 kwt = kwtools['templater'] |
271 status = _status(ui, repo, kwt, *pats, **opts) | 271 status = _status(ui, repo, kwt, False, *pats, **opts) |
272 modified, added, removed, deleted, unknown, ignored, clean = status | 272 modified, added, removed, deleted = status[:4] |
273 if modified or added or removed or deleted: | 273 if modified or added or removed or deleted: |
274 raise util.Abort(_('outstanding uncommitted changes')) | 274 raise util.Abort(_('outstanding uncommitted changes')) |
275 wlock = lock = None | 275 wlock = lock = None |
276 try: | 276 try: |
277 wlock = repo.wlock() | 277 wlock = repo.wlock() |
278 lock = repo.lock() | 278 lock = repo.lock() |
279 kwt.overwrite(None, expand, clean) | 279 kwt.overwrite(None, expand, status[6]) |
280 finally: | 280 finally: |
281 del wlock, lock | 281 del wlock, lock |
282 | 282 |
283 | 283 |
284 def demo(ui, repo, *args, **opts): | 284 def demo(ui, repo, *args, **opts): |
378 Crosscheck which files in working directory are potential targets for | 378 Crosscheck which files in working directory are potential targets for |
379 keyword expansion. | 379 keyword expansion. |
380 That is, files matched by [keyword] config patterns but not symlinks. | 380 That is, files matched by [keyword] config patterns but not symlinks. |
381 ''' | 381 ''' |
382 kwt = kwtools['templater'] | 382 kwt = kwtools['templater'] |
383 status = _status(ui, repo, kwt, *pats, **opts) | 383 status = _status(ui, repo, kwt, opts.get('untracked'), *pats, **opts) |
384 modified, added, removed, deleted, unknown, ignored, clean = status | 384 modified, added, removed, deleted, unknown, ignored, clean = status |
385 files = modified + added + clean | 385 files = modified + added + clean + unknown |
386 if opts.get('untracked'): | |
387 files += unknown | |
388 files.sort() | 386 files.sort() |
389 wctx = repo[None] | 387 wctx = repo[None] |
390 kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)] | 388 kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)] |
391 cwd = pats and repo.getcwd() or '' | 389 cwd = pats and repo.getcwd() or '' |
392 kwfstats = not opts.get('ignore') and (('K', kwfiles),) or () | 390 kwfstats = not opts.get('ignore') and (('K', kwfiles),) or () |