103 'RCSFile': '{file|basename},v', |
103 'RCSFile': '{file|basename},v', |
104 'Source': '{root}/{file},v', |
104 'Source': '{root}/{file},v', |
105 'Id': '{file|basename},v {node|short} {date|utcdate} {author|user}', |
105 'Id': '{file|basename},v {node|short} {date|utcdate} {author|user}', |
106 'Header': '{root}/{file},v {node|short} {date|utcdate} {author|user}', |
106 'Header': '{root}/{file},v {node|short} {date|utcdate} {author|user}', |
107 } |
107 } |
|
108 |
|
109 kwcommands = ('status', 'commit', 'update', 'revert', 'backout', 'diff', 'cat', |
|
110 'archive', 'pull', 'unbundle', 'import') |
108 |
111 |
109 def utcdate(date): |
112 def utcdate(date): |
110 '''Returns hgdate in cvs-like UTC format.''' |
113 '''Returns hgdate in cvs-like UTC format.''' |
111 return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date[0])) |
114 return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date[0])) |
112 |
115 |
222 Wraps commit to overwrite configured files with updated |
225 Wraps commit to overwrite configured files with updated |
223 keyword substitutions. |
226 keyword substitutions. |
224 This is done for local repos only, and only if there are |
227 This is done for local repos only, and only if there are |
225 files configured at all for keyword substitution.''' |
228 files configured at all for keyword substitution.''' |
226 |
229 |
227 if not repo.local(): |
230 if not repo.local() or getcmd(ui) not in kwcommands: |
228 return |
231 return |
229 |
232 |
230 inc, exc, archive, noarchive = [], ['.hg*'], [], ['.hg*'] |
233 inc, exc = [], ['.hg*'] |
231 for pat, opt in repo.ui.configitems('keyword'): |
234 for pat, opt in ui.configitems('keyword'): |
232 if opt == 'archive': |
235 if opt != 'ignore': |
233 archive.append(pat) |
236 inc.append(pat) |
234 elif opt == 'noarchive': |
237 else: |
235 noarchive.append(pat) |
|
236 elif opt == 'ignore': |
|
237 exc.append(pat) |
238 exc.append(pat) |
238 else: |
|
239 inc.append(pat) |
|
240 if getcmd(repo.ui) == 'archive': |
|
241 inc, exc = archive, noarchive |
|
242 if not inc: |
239 if not inc: |
243 return |
240 return |
244 |
241 |
245 repo.kwfmatcher = util.matcher(repo.root, inc=inc, exc=exc)[1] |
242 repo.kwfmatcher = util.matcher(repo.root, inc=inc, exc=exc)[1] |
246 |
243 |