##// END OF EJS Templates
py3: add b'' prefixes in fakepatchtime.py...
Pulkit Goyal -
r36343:9a756197 default
parent child Browse files
Show More
@@ -1,40 +1,40 b''
1 # extension to emulate invoking 'patch.internalpatch()' at the time
1 # extension to emulate invoking 'patch.internalpatch()' at the time
2 # specified by '[fakepatchtime] fakenow'
2 # specified by '[fakepatchtime] fakenow'
3
3
4 from __future__ import absolute_import
4 from __future__ import absolute_import
5
5
6 from mercurial import (
6 from mercurial import (
7 extensions,
7 extensions,
8 patch as patchmod,
8 patch as patchmod,
9 registrar,
9 registrar,
10 util,
10 util,
11 )
11 )
12
12
13 configtable = {}
13 configtable = {}
14 configitem = registrar.configitem(configtable)
14 configitem = registrar.configitem(configtable)
15
15
16 configitem('fakepatchtime', 'fakenow',
16 configitem(b'fakepatchtime', b'fakenow',
17 default=None,
17 default=None,
18 )
18 )
19
19
20 def internalpatch(orig, ui, repo, patchobj, strip,
20 def internalpatch(orig, ui, repo, patchobj, strip,
21 prefix='', files=None,
21 prefix=b'', files=None,
22 eolmode='strict', similarity=0):
22 eolmode=b'strict', similarity=0):
23 if files is None:
23 if files is None:
24 files = set()
24 files = set()
25 r = orig(ui, repo, patchobj, strip,
25 r = orig(ui, repo, patchobj, strip,
26 prefix=prefix, files=files,
26 prefix=prefix, files=files,
27 eolmode=eolmode, similarity=similarity)
27 eolmode=eolmode, similarity=similarity)
28
28
29 fakenow = ui.config('fakepatchtime', 'fakenow')
29 fakenow = ui.config(b'fakepatchtime', b'fakenow')
30 if fakenow:
30 if fakenow:
31 # parsing 'fakenow' in YYYYmmddHHMM format makes comparison between
31 # parsing 'fakenow' in YYYYmmddHHMM format makes comparison between
32 # 'fakenow' value and 'touch -t YYYYmmddHHMM' argument easy
32 # 'fakenow' value and 'touch -t YYYYmmddHHMM' argument easy
33 fakenow = util.parsedate(fakenow, ['%Y%m%d%H%M'])[0]
33 fakenow = util.parsedate(fakenow, [b'%Y%m%d%H%M'])[0]
34 for f in files:
34 for f in files:
35 repo.wvfs.utime(f, (fakenow, fakenow))
35 repo.wvfs.utime(f, (fakenow, fakenow))
36
36
37 return r
37 return r
38
38
39 def extsetup(ui):
39 def extsetup(ui):
40 extensions.wrapfunction(patchmod, 'internalpatch', internalpatch)
40 extensions.wrapfunction(patchmod, 'internalpatch', internalpatch)
General Comments 0
You need to be logged in to leave comments. Login now