##// END OF EJS Templates
tests: add extension to emulate invoking internalpatch at the specific time...
FUJIWARA Katsunori -
r25756:a4a41525 default
parent child Browse files
Show More
@@ -0,0 +1,26 b''
1 # extension to emulate invoking 'patch.internalpatch()' at the time
2 # specified by '[fakepatchtime] fakenow'
3
4 from mercurial import extensions, patch as patchmod, util
5
6 def internalpatch(orig, ui, repo, patchobj, strip,
7 prefix='', files=None,
8 eolmode='strict', similarity=0):
9 if files is None:
10 files = set()
11 r = orig(ui, repo, patchobj, strip,
12 prefix=prefix, files=files,
13 eolmode=eolmode, similarity=similarity)
14
15 fakenow = ui.config('fakepatchtime', 'fakenow')
16 if fakenow:
17 # parsing 'fakenow' in YYYYmmddHHMM format makes comparison between
18 # 'fakenow' value and 'touch -t YYYYmmddHHMM' argument easy
19 fakenow = util.parsedate(fakenow, ['%Y%m%d%H%M'])[0]
20 for f in files:
21 repo.wvfs.utime(f, (fakenow, fakenow))
22
23 return r
24
25 def extsetup(ui):
26 extensions.wrapfunction(patchmod, 'internalpatch', internalpatch)
General Comments 0
You need to be logged in to leave comments. Login now