##// END OF EJS Templates
branching: merge with stable
marmoute -
r50994:0f0880c8 merge default
parent child Browse files
Show More
@@ -58,7 +58,7 b' help:'
58 58 all: build doc
59 59
60 60 local:
61 $(PYTHON) setup.py $(PURE) \
61 MERCURIAL_SETUP_MAKE_LOCAL=1 $(PYTHON) setup.py $(PURE) \
62 62 build_py -c -d . \
63 63 build_ext $(COMPILERFLAG) -i \
64 64 build_hgexe $(COMPILERFLAG) -i \
@@ -114,6 +114,8 b' class _dirstatemapcommon:'
114 114 new_docket = docketmod.DirstateDocket.with_new_uuid(
115 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 119 data_filename = new_docket.data_filename()
118 120 self._opener.write(data_filename, packed)
119 121 # tell the transaction that we are adding a new file
@@ -21,6 +21,11 b' def sysstr(s):'
21 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 29 import ssl
25 30
26 31 # ssl.HAS_TLSv1* are preferred to check support but they were added in Python
@@ -288,10 +293,11 b' def findhg():'
288 293 if retcode == 0 and not filterhgerr(err):
289 294 return hgcommand(hgcmd, hgenv)
290 295
291 raise SystemExit(
292 'Unable to find a working hg binary to extract the '
293 'version from the repository tags'
294 )
296 eprint("/!\\")
297 eprint(r"/!\ Unable to find a working hg binary")
298 eprint(r"/!\ Version cannot be extract from the repository")
299 eprint(r"/!\ Re-run the setup once a first version is built")
300 return None
295 301
296 302
297 303 def localhgenv():
@@ -316,33 +322,46 b' def localhgenv():'
316 322
317 323 version = ''
318 324
319 if os.path.isdir('.hg'):
325
326 def _try_get_version():
320 327 hg = findhg()
328 if hg is None:
329 return ''
330 hgid = None
331 numerictags = []
321 332 cmd = ['log', '-r', '.', '--template', '{tags}\n']
322 numerictags = [t for t in sysstr(hg.run(cmd)).split() if t[0:1].isdigit()]
333 pieces = sysstr(hg.run(cmd)).split()
334 numerictags = [t for t in pieces if t[0:1].isdigit()]
323 335 hgid = sysstr(hg.run(['id', '-i'])).strip()
324 336 if not hgid:
325 # Bail out if hg is having problems interacting with this repository,
326 # rather than falling through and producing a bogus version number.
327 # Continuing with an invalid version number will break extensions
328 # that define minimumhgversion.
329 raise SystemExit('Unable to determine hg version from local repository')
337 eprint("/!\\")
338 eprint(r"/!\ Unable to determine hg version from local repository")
339 eprint(r"/!\ Failed to retrieve current revision tags")
340 return ''
330 341 if numerictags: # tag(s) found
331 342 version = numerictags[-1]
332 343 if hgid.endswith('+'): # propagate the dirty status to the tag
333 344 version += '+'
334 else: # no tag found
345 else: # no tag found on the checked out revision
335 346 ltagcmd = ['parents', '--template', '{latesttag}']
336 347 ltag = sysstr(hg.run(ltagcmd))
337 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 355 changessincecmd = ['log', '-T', 'x\n', '-r', "only(.,'%s')" % ltag]
340 356 changessince = len(hg.run(changessincecmd).splitlines())
341 if ltag == 'null':
342 ltag = '0.0'
343 357 version = '%s+hg%s.%s' % (ltag, changessince, hgid)
344 358 if version.endswith('+'):
345 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 365 elif os.path.exists('.hg_archival.txt'):
347 366 kw = dict(
348 367 [[t.strip() for t in l.split(':', 1)] for l in open('.hg_archival.txt')]
@@ -362,21 +381,35 b" elif os.path.exists('mercurial/__version"
362 381 with open('mercurial/__version__.py') as f:
363 382 data = f.read()
364 383 version = re.search('version = b"(.*)"', data).group(1)
365
366 if version:
367 versionb = version
368 if not isinstance(versionb, bytes):
369 versionb = versionb.encode('ascii')
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)
370 399
371 write_if_changed(
372 'mercurial/__version__.py',
373 b''.join(
374 [
375 b'# this file is autogenerated by setup.py\n'
376 b'version = b"%s"\n' % versionb,
377 ]
378 ),
379 )
400 versionb = version
401 if not isinstance(versionb, bytes):
402 versionb = versionb.encode('ascii')
403
404 write_if_changed(
405 'mercurial/__version__.py',
406 b''.join(
407 [
408 b'# this file is autogenerated by setup.py\n'
409 b'version = b"%s"\n' % versionb,
410 ]
411 ),
412 )
380 413
381 414
382 415 class hgbuild(build):
@@ -352,11 +352,10 b' remove foo'
352 352 repository cache
353 353 ----------------
354 354
355 $ rm log/server.log*
356 355 $ cp $HGRCPATH.unconfigured $HGRCPATH
357 356 $ cat <<'EOF' >> $HGRCPATH
358 357 > [cmdserver]
359 > log = $TESTTMP/log/server.log
358 > log = $TESTTMP/log/server-cached.log
360 359 > max-repo-cache = 1
361 360 > track-log = command, repocache
362 361 > EOF
@@ -420,9 +419,7 b' shut down servers and restore environmen'
420 419
421 420 check server log:
422 421
423 $ cat log/server.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=...) (?)
422 $ cat log/server-cached.log | filterlog
426 423 YYYY/MM/DD HH:MM:SS (PID)> init cached
427 424 YYYY/MM/DD HH:MM:SS (PID)> id -R cached
428 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