Mercurial > evolve
comparison hgext3rd/topic/__init__.py @ 5193:a4d081923c81
compat: update hg-X.Y compat comments and test them
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Tue, 10 Mar 2020 19:05:08 +0700 |
parents | 9ac6779d608c |
children | 034d6d0efa7d |
comparison
equal
deleted
inserted
replaced
5192:f5b366a31740 | 5193:a4d081923c81 |
---|---|
479 if desc in (b'strip', b'repair') or ctr is not None: | 479 if desc in (b'strip', b'repair') or ctr is not None: |
480 return tr | 480 return tr |
481 | 481 |
482 reporef = weakref.ref(self) | 482 reporef = weakref.ref(self) |
483 if self.ui.configbool(b'experimental', b'enforce-single-head'): | 483 if self.ui.configbool(b'experimental', b'enforce-single-head'): |
484 if util.safehasattr(tr, 'validator'): # hg <= 4.7 | 484 if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) |
485 origvalidator = tr.validator | 485 origvalidator = tr.validator |
486 else: | 486 else: |
487 origvalidator = tr._validator | 487 origvalidator = tr._validator |
488 | 488 |
489 def validator(tr2): | 489 def validator(tr2): |
490 repo = reporef() | 490 repo = reporef() |
491 flow.enforcesinglehead(repo, tr2) | 491 flow.enforcesinglehead(repo, tr2) |
492 origvalidator(tr2) | 492 origvalidator(tr2) |
493 | 493 |
494 if util.safehasattr(tr, 'validator'): # hg <= 4.7 | 494 if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) |
495 tr.validator = validator | 495 tr.validator = validator |
496 else: | 496 else: |
497 tr._validator = validator | 497 tr._validator = validator |
498 | 498 |
499 topicmodeserver = self.ui.config(b'experimental', | 499 topicmodeserver = self.ui.config(b'experimental', |
500 b'topic-mode.server', b'ignore') | 500 b'topic-mode.server', b'ignore') |
501 ispush = (desc.startswith(b'push') or desc.startswith(b'serve')) | 501 ispush = (desc.startswith(b'push') or desc.startswith(b'serve')) |
502 if (topicmodeserver != b'ignore' and ispush): | 502 if (topicmodeserver != b'ignore' and ispush): |
503 if util.safehasattr(tr, 'validator'): # hg <= 4.7 | 503 if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) |
504 origvalidator = tr.validator | 504 origvalidator = tr.validator |
505 else: | 505 else: |
506 origvalidator = tr._validator | 506 origvalidator = tr._validator |
507 | 507 |
508 def validator(tr2): | 508 def validator(tr2): |
509 repo = reporef() | 509 repo = reporef() |
510 flow.rejectuntopicedchangeset(repo, tr2) | 510 flow.rejectuntopicedchangeset(repo, tr2) |
511 return origvalidator(tr2) | 511 return origvalidator(tr2) |
512 if util.safehasattr(tr, 'validator'): # hg <= 4.7 | 512 if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) |
513 tr.validator = validator | 513 tr.validator = validator |
514 else: | 514 else: |
515 tr._validator = validator | 515 tr._validator = validator |
516 | 516 |
517 elif (self.ui.configbool(b'experimental', b'topic.publish-bare-branch') | 517 elif (self.ui.configbool(b'experimental', b'topic.publish-bare-branch') |
529 tr.close = close | 529 tr.close = close |
530 allow_publish = self.ui.configbool(b'experimental', | 530 allow_publish = self.ui.configbool(b'experimental', |
531 b'topic.allow-publish', | 531 b'topic.allow-publish', |
532 True) | 532 True) |
533 if not allow_publish: | 533 if not allow_publish: |
534 if util.safehasattr(tr, 'validator'): # hg <= 4.7 | 534 if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) |
535 origvalidator = tr.validator | 535 origvalidator = tr.validator |
536 else: | 536 else: |
537 origvalidator = tr._validator | 537 origvalidator = tr._validator |
538 | 538 |
539 def validator(tr2): | 539 def validator(tr2): |
540 repo = reporef() | 540 repo = reporef() |
541 flow.reject_publish(repo, tr2) | 541 flow.reject_publish(repo, tr2) |
542 return origvalidator(tr2) | 542 return origvalidator(tr2) |
543 if util.safehasattr(tr, 'validator'): # hg <= 4.7 | 543 if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) |
544 tr.validator = validator | 544 tr.validator = validator |
545 else: | 545 else: |
546 tr._validator = validator | 546 tr._validator = validator |
547 | 547 |
548 # real transaction start | 548 # real transaction start |