hgkw/keyword.py
branchsolo-extension
changeset 52 7783eb22de30
parent 51 1ecb6ec5d16b
child 53 b0db8ec7ac78
equal deleted inserted replaced
51:1ecb6ec5d16b 52:7783eb22de30
    11 repository.
    11 repository.
    12 
    12 
    13 There are many good reasons why this is not needed in a distributed
    13 There are many good reasons why this is not needed in a distributed
    14 SCM, still it may be useful in very small projects based on single
    14 SCM, still it may be useful in very small projects based on single
    15 files (like LaTeX packages), that are mostly addressed to an audience
    15 files (like LaTeX packages), that are mostly addressed to an audience
    16 not running version control.
    16 not running a version control system.
    17 
    17 
    18 The extension consists actually in 2 parts:
    18 The extension consists actually in 2 parts:
    19 
    19 
    20     1. extension code (reposetup) that is triggered on checkout and
    20     1. extension code (reposetup) that is triggered on checkout and
    21        logging of changes.
    21        logging of changes.
   106                 text = re_kw.sub(r'$\1$', text)
   106                 text = re_kw.sub(r'$\1$', text)
   107             return super(kwfilelog, self).add(text, meta, tr, link, p1, p2)
   107             return super(kwfilelog, self).add(text, meta, tr, link, p1, p2)
   108 
   108 
   109         def size(self, rev):
   109         def size(self, rev):
   110             '''Overrides filelog's size() to use kwfilelog.read().'''
   110             '''Overrides filelog's size() to use kwfilelog.read().'''
   111             node = self.node(rev)
   111             node = revlog.node(self, rev)
   112             if self.renamed(node):
   112             if super(kwfilelog, self).renamed(node):
   113                 return len(self.read(node))
   113                 return len(self.read(node))
   114             return revlog.size(self, rev)
   114             return revlog.size(self, rev)
   115 
   115 
   116         def cmp(self, node, text):
   116         def cmp(self, node, text):
   117             '''Overrides filelog's cmp() to use kwfilelog.read().'''
   117             '''Overrides filelog's cmp() to use kwfilelog.read().'''
   118             if self.renamed(node):
   118             if super(kwfilelog, self).renamed(node):
   119                 t2 = self.read(node)
   119                 t2 = self.read(node)
   120                 return t2 != text
   120                 return t2 != text
   121 
   121 
   122     filelog.filelog = kwfilelog
   122     filelog.filelog = kwfilelog
   123     repo.__class__ = kwrepo
   123     repo.__class__ = kwrepo