comparison hgext3rd/topic/__init__.py @ 5939:0511ad9f0862 mercurial-5.6

test-compat: merge mercurial-5.7 into mercurial-5.6
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 27 May 2021 23:09:47 +0800
parents 8d36bfe9968a
children aff365171309 30c8d8e6a7f4
comparison
equal deleted inserted replaced
5892:34cd08a46b6d 5939:0511ad9f0862
230 # (first pick I could think off, update as needed 230 # (first pick I could think off, update as needed
231 b'log.topic': b'green_background', 231 b'log.topic': b'green_background',
232 b'topic.active': b'green', 232 b'topic.active': b'green',
233 } 233 }
234 234
235 __version__ = b'0.22.1.dev' 235 __version__ = b'0.22.2.dev'
236 236
237 testedwith = b'4.6.2 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7' 237 testedwith = b'4.6.2 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8'
238 minimumhgversion = b'4.6' 238 minimumhgversion = b'4.6'
239 buglink = b'https://bz.mercurial-scm.org/' 239 buglink = b'https://bz.mercurial-scm.org/'
240 240
241 if util.safehasattr(registrar, 'configitem'): 241 if util.safehasattr(registrar, 'configitem'):
242 242
588 else: 588 else:
589 tr.addvalidator(b'000-enforce-single-head', _validate) 589 tr.addvalidator(b'000-enforce-single-head', _validate)
590 590
591 topicmodeserver = self.ui.config(b'experimental', 591 topicmodeserver = self.ui.config(b'experimental',
592 b'topic-mode.server', b'ignore') 592 b'topic-mode.server', b'ignore')
593 ispush = (desc.startswith(b'push') or desc.startswith(b'serve')) 593 publishbare = self.ui.configbool(b'experimental',
594 b'topic.publish-bare-branch')
595 ispush = desc.startswith((b'push', b'serve'))
594 if (topicmodeserver != b'ignore' and ispush): 596 if (topicmodeserver != b'ignore' and ispush):
595 if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) 597 if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66)
596 origvalidator = tr.validator 598 origvalidator = tr.validator
597 elif util.safehasattr(tr, '_validator'): 599 elif util.safehasattr(tr, '_validator'):
598 # hg <= 5.3 (36f08ae87ef6) 600 # hg <= 5.3 (36f08ae87ef6)
614 # hg <= 5.3 (36f08ae87ef6) 616 # hg <= 5.3 (36f08ae87ef6)
615 tr._validator = validator 617 tr._validator = validator
616 else: 618 else:
617 tr.addvalidator(b'000-reject-untopiced', _validate) 619 tr.addvalidator(b'000-reject-untopiced', _validate)
618 620
619 elif (self.ui.configbool(b'experimental', b'topic.publish-bare-branch') 621 elif publishbare and ispush:
620 and (desc.startswith(b'push')
621 or desc.startswith(b'serve'))
622 ):
623 origclose = tr.close 622 origclose = tr.close
624 trref = weakref.ref(tr) 623 trref = weakref.ref(tr)
625 624
626 def close(): 625 def close():
627 repo = reporef() 626 repo = reporef()
1056 p1 = None 1055 p1 = None
1057 p2 = None 1056 p2 = None
1058 successors = {} 1057 successors = {}
1059 for r in revs: 1058 for r in revs:
1060 c = repo[r] 1059 c = repo[r]
1060
1061 if len(c.parents()) > 1:
1062 # ctx.files() isn't reliable for merges, so fall back to the
1063 # slower repo.status() method
1064 st = c.p1().status(c)
1065 files = set(st.modified) | set(st.added) | set(st.removed)
1066 else:
1067 files = set(c.files())
1061 1068
1062 def filectxfn(repo, ctx, path): 1069 def filectxfn(repo, ctx, path):
1063 try: 1070 try:
1064 return c[path] 1071 return c[path]
1065 except error.ManifestLookupError: 1072 except error.ManifestLookupError:
1095 if p2 in successors: 1102 if p2 in successors:
1096 p2 = successors[p2][0] 1103 p2 = successors[p2][0]
1097 mc = context.memctx(repo, 1104 mc = context.memctx(repo,
1098 (p1, p2), 1105 (p1, p2),
1099 c.description(), 1106 c.description(),
1100 c.files(), 1107 files,
1101 filectxfn, 1108 filectxfn,
1102 user=c.user(), 1109 user=c.user(),
1103 date=c.date(), 1110 date=c.date(),
1104 extra=fixedextra) 1111 extra=fixedextra)
1105 1112