Handle LookupError eg. for hg convert
--- a/hgkw/keyword.py Tue Jan 29 21:15:57 2008 +0100
+++ b/hgkw/keyword.py Wed Jan 30 01:24:10 2008 +0100
@@ -133,10 +133,14 @@
# kwrepo.wwrite except when overwriting on commit
if self.ctx is None:
self.ctx = self.repo.changectx()
- fnode = self.ctx.filenode(path)
- fl = self.repo.file(path)
- c = context.filectx(self.repo, path, fileid=fnode, filelog=fl)
- node = c.node()
+ try:
+ fnode = self.ctx.filenode(path)
+ fl = self.repo.file(path)
+ c = context.filectx(self.repo, path, fileid=fnode, filelog=fl)
+ node = c.node()
+ except revlog.LookupError:
+ # eg: convert
+ return subfunc == self.re_kw.sub and data or (data, None)
elif subfunc == self.re_kw.sub:
# hg kwcat using kwfilelog.read
c = context.filectx(self.repo, path, fileid=node)