##// END OF EJS Templates
merge with stable
Yuya Nishihara -
r45068:f8427841 merge default
parent child Browse files
Show More
@@ -328,6 +328,7 b' def main():'
328 'allow-attr-methods': args.allow_attr_methods,
328 'allow-attr-methods': args.allow_attr_methods,
329 }
329 }
330 for fname in args.files:
330 for fname in args.files:
331 fname = os.path.realpath(fname)
331 if args.inplace:
332 if args.inplace:
332 with editinplace(fname) as fout:
333 with editinplace(fname) as fout:
333 with open(fname, 'rb') as fin:
334 with open(fname, 'rb') as fin:
@@ -6,7 +6,7 b' before_script:'
6 - hg clone . /tmp/mercurial-ci/ --noupdate
6 - hg clone . /tmp/mercurial-ci/ --noupdate
7 - hg -R /tmp/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
7 - hg -R /tmp/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
8 - cd /tmp/mercurial-ci/
8 - cd /tmp/mercurial-ci/
9 - (cd tests; ls -1 test-check-*.*) > /tmp/check-tests.txt
9 - ls -1 tests/test-check-*.* > /tmp/check-tests.txt
10
10
11 variables:
11 variables:
12 PYTHON: python
12 PYTHON: python
@@ -14,10 +14,9 b' variables:'
14
14
15 .runtests_template: &runtests
15 .runtests_template: &runtests
16 script:
16 script:
17 - cd tests/
18 - echo "python used, $PYTHON"
17 - echo "python used, $PYTHON"
19 - echo "$RUNTEST_ARGS"
18 - echo "$RUNTEST_ARGS"
20 - HGMODULEPOLICY="$TEST_HGMODULEPOLICY" "$PYTHON" run-tests.py --color=always $RUNTEST_ARGS
19 - HGMODULEPOLICY="$TEST_HGMODULEPOLICY" "$PYTHON" tests/run-tests.py --color=always $RUNTEST_ARGS
21
20
22 checks-py2:
21 checks-py2:
23 <<: *runtests
22 <<: *runtests
@@ -135,34 +135,38 b' class tarit(object):'
135 '''write archive to tar file or stream. can write uncompressed,
135 '''write archive to tar file or stream. can write uncompressed,
136 or compress with gzip or bzip2.'''
136 or compress with gzip or bzip2.'''
137
137
138 class GzipFileWithTime(gzip.GzipFile):
138 if pycompat.ispy3:
139 def __init__(self, *args, **kw):
139 GzipFileWithTime = gzip.GzipFile # camelcase-required
140 timestamp = None
140 else:
141 if 'timestamp' in kw:
141
142 timestamp = kw.pop('timestamp')
142 class GzipFileWithTime(gzip.GzipFile):
143 if timestamp is None:
143 def __init__(self, *args, **kw):
144 self.timestamp = time.time()
144 timestamp = None
145 else:
145 if 'mtime' in kw:
146 self.timestamp = timestamp
146 timestamp = kw.pop('mtime')
147 gzip.GzipFile.__init__(self, *args, **kw)
147 if timestamp is None:
148 self.timestamp = time.time()
149 else:
150 self.timestamp = timestamp
151 gzip.GzipFile.__init__(self, *args, **kw)
148
152
149 def _write_gzip_header(self):
153 def _write_gzip_header(self):
150 self.fileobj.write(b'\037\213') # magic header
154 self.fileobj.write(b'\037\213') # magic header
151 self.fileobj.write(b'\010') # compression method
155 self.fileobj.write(b'\010') # compression method
152 fname = self.name
156 fname = self.name
153 if fname and fname.endswith(b'.gz'):
157 if fname and fname.endswith(b'.gz'):
154 fname = fname[:-3]
158 fname = fname[:-3]
155 flags = 0
159 flags = 0
156 if fname:
160 if fname:
157 flags = gzip.FNAME # pytype: disable=module-attr
161 flags = gzip.FNAME # pytype: disable=module-attr
158 self.fileobj.write(pycompat.bytechr(flags))
162 self.fileobj.write(pycompat.bytechr(flags))
159 gzip.write32u( # pytype: disable=module-attr
163 gzip.write32u( # pytype: disable=module-attr
160 self.fileobj, int(self.timestamp)
164 self.fileobj, int(self.timestamp)
161 )
165 )
162 self.fileobj.write(b'\002')
166 self.fileobj.write(b'\002')
163 self.fileobj.write(b'\377')
167 self.fileobj.write(b'\377')
164 if fname:
168 if fname:
165 self.fileobj.write(fname + b'\000')
169 self.fileobj.write(fname + b'\000')
166
170
167 def __init__(self, dest, mtime, kind=b''):
171 def __init__(self, dest, mtime, kind=b''):
168 self.mtime = mtime
172 self.mtime = mtime
@@ -178,7 +182,7 b' class tarit(object):'
178 pycompat.sysstr(mode + b'b'),
182 pycompat.sysstr(mode + b'b'),
179 zlib.Z_BEST_COMPRESSION,
183 zlib.Z_BEST_COMPRESSION,
180 fileobj,
184 fileobj,
181 timestamp=mtime,
185 mtime=mtime,
182 )
186 )
183 self.fileobj = gzfileobj
187 self.fileobj = gzfileobj
184 return tarfile.TarFile.taropen( # pytype: disable=attribute-error
188 return tarfile.TarFile.taropen( # pytype: disable=attribute-error
@@ -159,7 +159,10 b' static const char *index_deref(indexObje'
159 sizeof(*self->offsets));
159 sizeof(*self->offsets));
160 if (self->offsets == NULL)
160 if (self->offsets == NULL)
161 return (const char *)PyErr_NoMemory();
161 return (const char *)PyErr_NoMemory();
162 inline_scan(self, self->offsets);
162 Py_ssize_t ret = inline_scan(self, self->offsets);
163 if (ret == -1) {
164 return NULL;
165 };
163 }
166 }
164 return self->offsets[pos];
167 return self->offsets[pos];
165 }
168 }
@@ -27,6 +27,14 b' pub use revlog::*;'
27 pub mod re2;
27 pub mod re2;
28 pub mod utils;
28 pub mod utils;
29
29
30 // Remove this to see (potential) non-artificial compile failures. MacOS
31 // *should* compile, but fail to compile tests for example as of 2020-03-06
32 #[cfg(not(target_os = "linux"))]
33 compile_error!(
34 "`hg-core` has only been tested on Linux and will most \
35 likely not behave correctly on other platforms."
36 );
37
30 use crate::utils::hg_path::{HgPathBuf, HgPathError};
38 use crate::utils::hg_path::{HgPathBuf, HgPathError};
31 pub use filepatterns::{
39 pub use filepatterns::{
32 parse_pattern_syntax, read_pattern_file, IgnorePattern,
40 parse_pattern_syntax, read_pattern_file, IgnorePattern,
@@ -1632,7 +1632,7 b' class TTest(Test):'
1632 return self._have.get(allreqs)
1632 return self._have.get(allreqs)
1633
1633
1634 # TODO do something smarter when all other uses of hghave are gone.
1634 # TODO do something smarter when all other uses of hghave are gone.
1635 runtestdir = os.path.abspath(os.path.dirname(_sys2bytes(__file__)))
1635 runtestdir = osenvironb[b'RUNTESTDIR']
1636 tdir = runtestdir.replace(b'\\', b'/')
1636 tdir = runtestdir.replace(b'\\', b'/')
1637 proc = Popen4(
1637 proc = Popen4(
1638 b'%s -c "%s/hghave %s"' % (self._shell, tdir, allreqs),
1638 b'%s -c "%s/hghave %s"' % (self._shell, tdir, allreqs),
General Comments 0
You need to be logged in to leave comments. Login now