Show More
@@ -58,7 +58,7 b' help:' | |||||
58 | all: build doc |
|
58 | all: build doc | |
59 |
|
59 | |||
60 | local: |
|
60 | local: | |
61 | $(PYTHON) setup.py $(PURE) \ |
|
61 | MERCURIAL_SETUP_MAKE_LOCAL=1 $(PYTHON) setup.py $(PURE) \ | |
62 | build_py -c -d . \ |
|
62 | build_py -c -d . \ | |
63 | build_ext $(COMPILERFLAG) -i \ |
|
63 | build_ext $(COMPILERFLAG) -i \ | |
64 | build_hgexe $(COMPILERFLAG) -i \ |
|
64 | build_hgexe $(COMPILERFLAG) -i \ |
@@ -114,6 +114,8 b' class _dirstatemapcommon:' | |||||
114 | new_docket = docketmod.DirstateDocket.with_new_uuid( |
|
114 | new_docket = docketmod.DirstateDocket.with_new_uuid( | |
115 | self.parents(), len(packed), meta |
|
115 | self.parents(), len(packed), meta | |
116 | ) |
|
116 | ) | |
|
117 | if old_docket.uuid == new_docket.uuid: | |||
|
118 | raise error.ProgrammingError(b'dirstate docket name collision') | |||
117 | data_filename = new_docket.data_filename() |
|
119 | data_filename = new_docket.data_filename() | |
118 | self._opener.write(data_filename, packed) |
|
120 | self._opener.write(data_filename, packed) | |
119 | # tell the transaction that we are adding a new file |
|
121 | # tell the transaction that we are adding a new file |
@@ -21,6 +21,11 b' def sysstr(s):' | |||||
21 | return s.decode('latin-1') |
|
21 | return s.decode('latin-1') | |
22 |
|
22 | |||
23 |
|
23 | |||
|
24 | def eprint(*args, **kwargs): | |||
|
25 | kwargs['file'] = sys.stderr | |||
|
26 | print(*args, **kwargs) | |||
|
27 | ||||
|
28 | ||||
24 | import ssl |
|
29 | import ssl | |
25 |
|
30 | |||
26 | # ssl.HAS_TLSv1* are preferred to check support but they were added in Python |
|
31 | # ssl.HAS_TLSv1* are preferred to check support but they were added in Python | |
@@ -288,10 +293,11 b' def findhg():' | |||||
288 | if retcode == 0 and not filterhgerr(err): |
|
293 | if retcode == 0 and not filterhgerr(err): | |
289 | return hgcommand(hgcmd, hgenv) |
|
294 | return hgcommand(hgcmd, hgenv) | |
290 |
|
295 | |||
291 | raise SystemExit( |
|
296 | eprint("/!\\") | |
292 |
|
|
297 | eprint(r"/!\ Unable to find a working hg binary") | |
293 | 'version from the repository tags' |
|
298 | eprint(r"/!\ Version cannot be extract from the repository") | |
294 | ) |
|
299 | eprint(r"/!\ Re-run the setup once a first version is built") | |
|
300 | return None | |||
295 |
|
301 | |||
296 |
|
302 | |||
297 | def localhgenv(): |
|
303 | def localhgenv(): | |
@@ -316,33 +322,46 b' def localhgenv():' | |||||
316 |
|
322 | |||
317 | version = '' |
|
323 | version = '' | |
318 |
|
324 | |||
319 | if os.path.isdir('.hg'): |
|
325 | ||
|
326 | def _try_get_version(): | |||
320 | hg = findhg() |
|
327 | hg = findhg() | |
|
328 | if hg is None: | |||
|
329 | return '' | |||
|
330 | hgid = None | |||
|
331 | numerictags = [] | |||
321 | cmd = ['log', '-r', '.', '--template', '{tags}\n'] |
|
332 | cmd = ['log', '-r', '.', '--template', '{tags}\n'] | |
322 |
|
|
333 | pieces = sysstr(hg.run(cmd)).split() | |
|
334 | numerictags = [t for t in pieces if t[0:1].isdigit()] | |||
323 | hgid = sysstr(hg.run(['id', '-i'])).strip() |
|
335 | hgid = sysstr(hg.run(['id', '-i'])).strip() | |
324 | if not hgid: |
|
336 | if not hgid: | |
325 | # Bail out if hg is having problems interacting with this repository, |
|
337 | eprint("/!\\") | |
326 | # rather than falling through and producing a bogus version number. |
|
338 | eprint(r"/!\ Unable to determine hg version from local repository") | |
327 | # Continuing with an invalid version number will break extensions |
|
339 | eprint(r"/!\ Failed to retrieve current revision tags") | |
328 | # that define minimumhgversion. |
|
340 | return '' | |
329 | raise SystemExit('Unable to determine hg version from local repository') |
|
|||
330 | if numerictags: # tag(s) found |
|
341 | if numerictags: # tag(s) found | |
331 | version = numerictags[-1] |
|
342 | version = numerictags[-1] | |
332 | if hgid.endswith('+'): # propagate the dirty status to the tag |
|
343 | if hgid.endswith('+'): # propagate the dirty status to the tag | |
333 | version += '+' |
|
344 | version += '+' | |
334 | else: # no tag found |
|
345 | else: # no tag found on the checked out revision | |
335 | ltagcmd = ['parents', '--template', '{latesttag}'] |
|
346 | ltagcmd = ['parents', '--template', '{latesttag}'] | |
336 | ltag = sysstr(hg.run(ltagcmd)) |
|
347 | ltag = sysstr(hg.run(ltagcmd)) | |
337 | if not ltag: |
|
348 | if not ltag: | |
338 | ltag = 'null' |
|
349 | eprint("/!\\") | |
|
350 | eprint(r"/!\ Unable to determine hg version from local repository") | |||
|
351 | eprint( | |||
|
352 | r"/!\ Failed to retrieve current revision distance to lated tag" | |||
|
353 | ) | |||
|
354 | return '' | |||
339 | changessincecmd = ['log', '-T', 'x\n', '-r', "only(.,'%s')" % ltag] |
|
355 | changessincecmd = ['log', '-T', 'x\n', '-r', "only(.,'%s')" % ltag] | |
340 | changessince = len(hg.run(changessincecmd).splitlines()) |
|
356 | changessince = len(hg.run(changessincecmd).splitlines()) | |
341 | if ltag == 'null': |
|
|||
342 | ltag = '0.0' |
|
|||
343 | version = '%s+hg%s.%s' % (ltag, changessince, hgid) |
|
357 | version = '%s+hg%s.%s' % (ltag, changessince, hgid) | |
344 | if version.endswith('+'): |
|
358 | if version.endswith('+'): | |
345 | version = version[:-1] + 'local' + time.strftime('%Y%m%d') |
|
359 | version = version[:-1] + 'local' + time.strftime('%Y%m%d') | |
|
360 | return version | |||
|
361 | ||||
|
362 | ||||
|
363 | if os.path.isdir('.hg'): | |||
|
364 | version = _try_get_version() | |||
346 | elif os.path.exists('.hg_archival.txt'): |
|
365 | elif os.path.exists('.hg_archival.txt'): | |
347 | kw = dict( |
|
366 | kw = dict( | |
348 | [[t.strip() for t in l.split(':', 1)] for l in open('.hg_archival.txt')] |
|
367 | [[t.strip() for t in l.split(':', 1)] for l in open('.hg_archival.txt')] | |
@@ -362,8 +381,22 b" elif os.path.exists('mercurial/__version" | |||||
362 | with open('mercurial/__version__.py') as f: |
|
381 | with open('mercurial/__version__.py') as f: | |
363 | data = f.read() |
|
382 | data = f.read() | |
364 | version = re.search('version = b"(.*)"', data).group(1) |
|
383 | version = re.search('version = b"(.*)"', data).group(1) | |
|
384 | if not version: | |||
|
385 | if os.environ.get("MERCURIAL_SETUP_MAKE_LOCAL") == "1": | |||
|
386 | version = "0.0+0" | |||
|
387 | eprint("/!\\") | |||
|
388 | eprint(r"/!\ Using '0.0+0' as the default version") | |||
|
389 | eprint(r"/!\ Re-run make local once that first version is built") | |||
|
390 | eprint("/!\\") | |||
|
391 | else: | |||
|
392 | eprint("/!\\") | |||
|
393 | eprint(r"/!\ Could not determine the Mercurial version") | |||
|
394 | eprint(r"/!\ You need to build a local version first") | |||
|
395 | eprint(r"/!\ Run `make local` and try again") | |||
|
396 | eprint("/!\\") | |||
|
397 | msg = "Run `make local` first to get a working local version" | |||
|
398 | raise SystemExit(msg) | |||
365 |
|
399 | |||
366 | if version: |
|
|||
367 |
|
|
400 | versionb = version | |
368 |
|
|
401 | if not isinstance(versionb, bytes): | |
369 |
|
|
402 | versionb = versionb.encode('ascii') |
@@ -352,11 +352,10 b' remove foo' | |||||
352 | repository cache |
|
352 | repository cache | |
353 | ---------------- |
|
353 | ---------------- | |
354 |
|
354 | |||
355 | $ rm log/server.log* |
|
|||
356 | $ cp $HGRCPATH.unconfigured $HGRCPATH |
|
355 | $ cp $HGRCPATH.unconfigured $HGRCPATH | |
357 | $ cat <<'EOF' >> $HGRCPATH |
|
356 | $ cat <<'EOF' >> $HGRCPATH | |
358 | > [cmdserver] |
|
357 | > [cmdserver] | |
359 | > log = $TESTTMP/log/server.log |
|
358 | > log = $TESTTMP/log/server-cached.log | |
360 | > max-repo-cache = 1 |
|
359 | > max-repo-cache = 1 | |
361 | > track-log = command, repocache |
|
360 | > track-log = command, repocache | |
362 | > EOF |
|
361 | > EOF | |
@@ -420,9 +419,7 b' shut down servers and restore environmen' | |||||
420 |
|
419 | |||
421 | check server log: |
|
420 | check server log: | |
422 |
|
421 | |||
423 | $ cat log/server.log | filterlog |
|
422 | $ cat log/server-cached.log | filterlog | |
424 | YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...) |
|
|||
425 | YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...) (?) |
|
|||
426 | YYYY/MM/DD HH:MM:SS (PID)> init cached |
|
423 | YYYY/MM/DD HH:MM:SS (PID)> init cached | |
427 | YYYY/MM/DD HH:MM:SS (PID)> id -R cached |
|
424 | YYYY/MM/DD HH:MM:SS (PID)> id -R cached | |
428 | YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s) |
|
425 | YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s) |
General Comments 0
You need to be logged in to leave comments.
Login now