hgkw/keyword.py
author Christian Ebert <blacktrash@gmx.net>
Mon, 08 Jan 2007 02:13:04 +0100
branchsolo-extension
changeset 72 28455872cb0e
parent 71 f7a2a246740c
child 73 26c78e6f67b8
child 74 85c345cd495b
permissions -rw-r--r--
Fix indent in entire kwrepo.commit function
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
     1
# keyword.py - keyword expansion for mercurial
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
     2
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
     3
'''keyword expansion hack against the grain of a DSCM
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
     4
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
     5
This extension lets you expand RCS/CVS-like keywords in a Mercurial
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
     6
repository.
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
     7
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
     8
There are many good reasons why this is not needed in a distributed
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
     9
SCM, still it may be useful in very small projects based on single
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    10
files (like LaTeX packages), that are mostly addressed to an audience
52
7783eb22de30 Make inheritance clearer in size() and add()
Christian Ebert <blacktrash@gmx.net>
parents: 51
diff changeset
    11
not running a version control system.
48
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    12
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    13
Supported $keywords$ are:
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    14
    Revision: changeset id
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    15
    Author:   full username
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    16
    Date:     %a %b %d %H:%M:%S %Y %z $
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    17
    RCSFile:  basename,v
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    18
    Source:   /path/to/basename,v
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    19
    Id:       basename,v csetid %Y-%m-%d %H:%M:%S %s shortname
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    20
    Header:   /path/to/basename,v csetid %Y-%m-%d %H:%M:%S %s shortname
48
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    21
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    22
Simple setup in hgrc:
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    23
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    24
    # enable extension
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    25
    # keyword.py in hgext folder, specify full path otherwise
48
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    26
    hgext.keyword =
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    27
    
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    28
    # filename patterns for expansion are configured in this section
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    29
    [keyword]
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    30
    **.py = expand
48
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    31
    ...
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    32
'''
59fedb6b41da add header and start documentation
Christian Ebert <blacktrash@gmx.net>
parents: 47
diff changeset
    33
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    34
from mercurial.node import *
65
188849659487 Unify obtaining filename matchers; only debug messages
Christian Ebert <blacktrash@gmx.net>
parents: 64
diff changeset
    35
from mercurial.i18n import _
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    36
from mercurial import context, filelog, revlog, util
64
4cd7b993c5f8 Imports specific to functions
Christian Ebert <blacktrash@gmx.net>
parents: 63
diff changeset
    37
import os.path, re
47
0617e7d497f6 Branch standalone extension, including pretxncommit hook function
Christian Ebert <blacktrash@gmx.net>
parents: 44
diff changeset
    38
59
94b26168791d Only 1 all-purpose regex, compiled at load
Christian Ebert <blacktrash@gmx.net>
parents: 58
diff changeset
    39
94b26168791d Only 1 all-purpose regex, compiled at load
Christian Ebert <blacktrash@gmx.net>
parents: 58
diff changeset
    40
re_kw = re.compile(
94b26168791d Only 1 all-purpose regex, compiled at load
Christian Ebert <blacktrash@gmx.net>
parents: 58
diff changeset
    41
        r'\$(Id|Header|Author|Date|Revision|RCSFile|Source)[^$]*?\$')
94b26168791d Only 1 all-purpose regex, compiled at load
Christian Ebert <blacktrash@gmx.net>
parents: 58
diff changeset
    42
47
0617e7d497f6 Branch standalone extension, including pretxncommit hook function
Christian Ebert <blacktrash@gmx.net>
parents: 44
diff changeset
    43
57
f95c21f87e9c Extract all information in kwexpand()
Christian Ebert <blacktrash@gmx.net>
parents: 56
diff changeset
    44
def kwexpand(matchobj, repo, path, changeid=None, fileid=None, filelog=None):
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    45
    '''Called by kwrepo.commit and kwfilelog.read.
47
0617e7d497f6 Branch standalone extension, including pretxncommit hook function
Christian Ebert <blacktrash@gmx.net>
parents: 44
diff changeset
    46
    Sets supported keywords as local variables and evaluates them to
0617e7d497f6 Branch standalone extension, including pretxncommit hook function
Christian Ebert <blacktrash@gmx.net>
parents: 44
diff changeset
    47
    their expansion if matchobj is equal to string representation.'''
57
f95c21f87e9c Extract all information in kwexpand()
Christian Ebert <blacktrash@gmx.net>
parents: 56
diff changeset
    48
    c = context.filectx(repo, path,
f95c21f87e9c Extract all information in kwexpand()
Christian Ebert <blacktrash@gmx.net>
parents: 56
diff changeset
    49
            changeid=changeid, fileid=fileid, filelog=filelog)
f95c21f87e9c Extract all information in kwexpand()
Christian Ebert <blacktrash@gmx.net>
parents: 56
diff changeset
    50
    date = c.date()
f95c21f87e9c Extract all information in kwexpand()
Christian Ebert <blacktrash@gmx.net>
parents: 56
diff changeset
    51
    Revision = c.changectx()
f95c21f87e9c Extract all information in kwexpand()
Christian Ebert <blacktrash@gmx.net>
parents: 56
diff changeset
    52
    Author = c.user()
f95c21f87e9c Extract all information in kwexpand()
Christian Ebert <blacktrash@gmx.net>
parents: 56
diff changeset
    53
    RCSFile = os.path.basename(path)+',v'
f95c21f87e9c Extract all information in kwexpand()
Christian Ebert <blacktrash@gmx.net>
parents: 56
diff changeset
    54
    Source = repo.wjoin(path)+',v'
47
0617e7d497f6 Branch standalone extension, including pretxncommit hook function
Christian Ebert <blacktrash@gmx.net>
parents: 44
diff changeset
    55
    Date = util.datestr(date=date)
53
b0db8ec7ac78 Change location of date format comment
Christian Ebert <blacktrash@gmx.net>
parents: 52
diff changeset
    56
    revdateauth = '%s %s %s' % (Revision,
47
0617e7d497f6 Branch standalone extension, including pretxncommit hook function
Christian Ebert <blacktrash@gmx.net>
parents: 44
diff changeset
    57
            util.datestr(date=date, format=util.defaultdateformats[0]),
60
9771775ef322 List supported keywords in doc
Christian Ebert <blacktrash@gmx.net>
parents: 59
diff changeset
    58
            util.shortuser(Author))
47
0617e7d497f6 Branch standalone extension, including pretxncommit hook function
Christian Ebert <blacktrash@gmx.net>
parents: 44
diff changeset
    59
    Header = '%s %s' % (Source, revdateauth)
0617e7d497f6 Branch standalone extension, including pretxncommit hook function
Christian Ebert <blacktrash@gmx.net>
parents: 44
diff changeset
    60
    Id = '%s %s' % (RCSFile, revdateauth)
0617e7d497f6 Branch standalone extension, including pretxncommit hook function
Christian Ebert <blacktrash@gmx.net>
parents: 44
diff changeset
    61
    return '$%s: %s $' % (matchobj.group(1), eval(matchobj.group(1)))
0617e7d497f6 Branch standalone extension, including pretxncommit hook function
Christian Ebert <blacktrash@gmx.net>
parents: 44
diff changeset
    62
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    63
def kwfmatches(ui, repo, files):
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    64
    '''Selects candidates for keyword substitution
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    65
    configured in keyword section in hgrc.'''
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    66
    files = [f for f in files if not f.startswith('.hg')]
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    67
    if not files:
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    68
        return []
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    69
    candidates = []
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    70
    fmatchers = [util.matcher(repo.root, '', [pat], [], [])[1]
65
188849659487 Unify obtaining filename matchers; only debug messages
Christian Ebert <blacktrash@gmx.net>
parents: 64
diff changeset
    71
            for pat, opt in ui.configitems('keyword')
188849659487 Unify obtaining filename matchers; only debug messages
Christian Ebert <blacktrash@gmx.net>
parents: 64
diff changeset
    72
            if opt == 'expand']
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    73
    for f in files:
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    74
        for mf in fmatchers:
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    75
            if mf(f):
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    76
                candidates.append(f)
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    77
                break
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    78
    return candidates
65
188849659487 Unify obtaining filename matchers; only debug messages
Christian Ebert <blacktrash@gmx.net>
parents: 64
diff changeset
    79
42
ba000e29ecf3 Implement near CVS compability with more than one keyword
Christian Ebert <blacktrash@gmx.net>
parents: 41
diff changeset
    80
33
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    81
def reposetup(ui, repo):
64
4cd7b993c5f8 Imports specific to functions
Christian Ebert <blacktrash@gmx.net>
parents: 63
diff changeset
    82
33
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    83
    if not repo.local():
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    84
        return
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    85
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    86
    class kwrepo(repo.__class__):
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    87
        def file(self, f):
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    88
            if f[0] == '/':
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    89
                f = f[1:]
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    90
            return filelog.filelog(self.sopener, f, self, self.revlogversion)
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    91
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    92
        def commit(self, files=None, text="", user=None, date=None,
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
    93
                match=util.always, force=False, lock=None, wlock=None,
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
    94
                force_editor=False, p1=None, p2=None, extra={}):
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
    95
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
    96
            commit = []
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
    97
            remove = []
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
    98
            changed = []
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
    99
            use_dirstate = (p1 is None) # not rawcommit
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   100
            extra = extra.copy()
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   101
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   102
            if use_dirstate:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   103
                if files:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   104
                    for f in files:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   105
                        s = self.dirstate.state(f)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   106
                        if s in 'nmai':
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   107
                            commit.append(f)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   108
                        elif s == 'r':
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   109
                            remove.append(f)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   110
                        else:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   111
                            ui.warn(_("%s not tracked!\n") % f)
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   112
                else:
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   113
                    changes = self.status(match=match)[:5]
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   114
                    modified, added, removed, deleted, unknown = changes
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   115
                    commit = modified + added
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   116
                    remove = removed
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   117
            else:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   118
                commit = files
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   119
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   120
            if use_dirstate:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   121
                p1, p2 = self.dirstate.parents()
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   122
                update_dirstate = True
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   123
            else:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   124
                p1, p2 = p1, p2 or nullid
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   125
                update_dirstate = (self.dirstate.parents()[0] == p1)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   126
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   127
            c1 = self.changelog.read(p1)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   128
            c2 = self.changelog.read(p2)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   129
            m1 = self.manifest.read(c1[0]).copy()
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   130
            m2 = self.manifest.read(c2[0])
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   131
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   132
            if use_dirstate:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   133
                branchname = self.workingctx().branch()
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   134
                try:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   135
                    branchname = branchname.decode('UTF-8').encode('UTF-8')
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   136
                except UnicodeDecodeError:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   137
                    raise util.Abort(_('branch name not in UTF-8!'))
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   138
            else:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   139
                branchname = ""
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   140
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   141
            if use_dirstate:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   142
                oldname = c1[5].get("branch", "") # stored in UTF-8
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   143
                if not commit and not remove and not force and p2 == nullid and \
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   144
                       branchname == oldname:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   145
                    ui.status(_("nothing changed\n"))
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   146
                    return None
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   147
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   148
            xp1 = hex(p1)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   149
            if p2 == nullid: xp2 = ''
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   150
            else: xp2 = hex(p2)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   151
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   152
            self.hook("precommit", throw=True, parent1=xp1, parent2=xp2)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   153
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   154
            if not wlock:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   155
                wlock = self.wlock()
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   156
            if not lock:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   157
                lock = self.lock()
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   158
            tr = self.transaction()
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   159
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   160
            # check in files
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   161
            new = {}
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   162
            linkrev = self.changelog.count()
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   163
            commit.sort()
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   164
            is_exec = util.execfunc(self.root, m1.execf)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   165
            is_link = util.linkfunc(self.root, m1.linkf)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   166
            for f in commit:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   167
                ui.note(f + "\n")
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   168
                try:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   169
                    new[f] = self.filecommit(f, m1, m2, linkrev, tr, changed)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   170
                    m1.set(f, is_exec(f), is_link(f))
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   171
                except OSError:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   172
                    if use_dirstate:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   173
                        ui.warn(_("trouble committing %s!\n") % f)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   174
                        raise
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   175
                    else:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   176
                        remove.append(f)
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   177
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   178
            # update manifest
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   179
            m1.update(new)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   180
            remove.sort()
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   181
            removed = []
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   182
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   183
            for f in remove:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   184
                if f in m1:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   185
                    del m1[f]
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   186
                    removed.append(f)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   187
            mn = self.manifest.add(m1, tr, linkrev, c1[0], c2[0], (new, removed))
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   188
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   189
            # add changeset
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   190
            new = new.keys()
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   191
            new.sort()
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   192
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   193
            user = user or ui.username()
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   194
            if not text or force_editor:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   195
                edittext = []
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   196
                if text:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   197
                    edittext.append(text)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   198
                edittext.append("")
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   199
                edittext.append("HG: user: %s" % user)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   200
                if p2 != nullid:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   201
                    edittext.append("HG: branch merge")
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   202
                edittext.extend(["HG: changed %s" % f for f in changed])
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   203
                edittext.extend(["HG: removed %s" % f for f in removed])
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   204
                if not changed and not remove:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   205
                    edittext.append("HG: no files changed")
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   206
                edittext.append("")
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   207
                # run editor in the repository root
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   208
                olddir = os.getcwd()
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   209
                os.chdir(self.root)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   210
                text = ui.edit("\n".join(edittext), user)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   211
                os.chdir(olddir)
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   212
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   213
            lines = [line.rstrip() for line in text.rstrip().splitlines()]
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   214
            while lines and not lines[0]:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   215
                del lines[0]
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   216
            if not lines:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   217
                return None
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   218
            text = '\n'.join(lines)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   219
            if branchname:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   220
                extra["branch"] = branchname
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   221
            n = self.changelog.add(mn, changed + removed, text, tr, p1, p2,
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   222
                                   user, date, extra)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   223
            self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   224
                      parent2=xp2)
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   225
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   226
            # substitute keywords
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   227
            for f in kwfmatches(ui, self, changed):
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   228
                data = self.wfile(f).read()
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   229
                if not util.binary(data):
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   230
                    data, kwct = re_kw.subn(lambda m:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   231
                            kwexpand(m, self, f, changeid=hex(n)),
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   232
                            data)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   233
                    if kwct:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   234
                        ui.debug(_('overwriting %s expanding keywords\n' % f))
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   235
                        self.wfile(f, 'w').write(data)
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   236
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   237
            tr.close()
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   238
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   239
            if use_dirstate or update_dirstate:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   240
                self.dirstate.setparents(n)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   241
                if use_dirstate:
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   242
                    self.dirstate.update(new, "n")
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   243
                    self.dirstate.forget(removed)
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   244
72
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   245
            self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2)
28455872cb0e Fix indent in entire kwrepo.commit function
Christian Ebert <blacktrash@gmx.net>
parents: 71
diff changeset
   246
            return n
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   247
33
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   248
    class kwfilelog(filelog.filelog):
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   249
        def __init__(self, opener, path, repo,
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   250
                     defversion=revlog.REVLOG_DEFAULT_VERSION):
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   251
            super(kwfilelog, self).__init__(opener, path, defversion)
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   252
            self._repo = repo
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   253
            self._path = path
36
b3ace8cc5a33 Change config opt "expand" to accept filename patterns
Christian Ebert <blacktrash@gmx.net>
parents: 34
diff changeset
   254
33
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   255
        def read(self, node):
42
ba000e29ecf3 Implement near CVS compability with more than one keyword
Christian Ebert <blacktrash@gmx.net>
parents: 41
diff changeset
   256
            data = super(kwfilelog, self).read(node)
69
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   257
            if not util.binary(data) and \
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   258
                    kwfmatches(ui, self._repo, [self._path]):
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   259
                ui.debug(_('expanding keywords in %s\n' % self._path))
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   260
                return re_kw.sub(lambda m:
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   261
                        kwexpand(m, self._repo, self._path,
4c5d9635b517 Pure extension by inserting keyword expansion localrepo.localrepository.commit
Christian Ebert <blacktrash@gmx.net>
parents: 68
diff changeset
   262
                            fileid=node, filelog=self), data)
51
1ecb6ec5d16b Reintroduce simpler kwfilelog.add(); simplify kwfilelog.read()
Christian Ebert <blacktrash@gmx.net>
parents: 50
diff changeset
   263
            return data
42
ba000e29ecf3 Implement near CVS compability with more than one keyword
Christian Ebert <blacktrash@gmx.net>
parents: 41
diff changeset
   264
49
5acfe7dc3086 Override filelog's size(), cmp() as well; remove add()
Christian Ebert <blacktrash@gmx.net>
parents: 48
diff changeset
   265
        def cmp(self, node, text):
71
f7a2a246740c No keyword substitution in cmp(); no overriding of size() ATM
Christian Ebert <blacktrash@gmx.net>
parents: 69
diff changeset
   266
            '''Removes keyword substitution for comparison.'''
f7a2a246740c No keyword substitution in cmp(); no overriding of size() ATM
Christian Ebert <blacktrash@gmx.net>
parents: 69
diff changeset
   267
            if not util.binary(text):
f7a2a246740c No keyword substitution in cmp(); no overriding of size() ATM
Christian Ebert <blacktrash@gmx.net>
parents: 69
diff changeset
   268
                text = re_kw.sub(r'$\1$', text)
f7a2a246740c No keyword substitution in cmp(); no overriding of size() ATM
Christian Ebert <blacktrash@gmx.net>
parents: 69
diff changeset
   269
            return super(kwfilelog, self).cmp(node, text)
33
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   270
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   271
    filelog.filelog = kwfilelog
ebb39c6a1476 Add original keyword extension by Thomas Arendsen Hain
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   272
    repo.__class__ = kwrepo