comparison hgext3rd/topic/__init__.py @ 3902:9c4847b93d3c

branching: merge with stable
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 31 Jul 2018 09:03:35 +0200
parents 28dadd024299 b91db6989231
children 9839463088ac
comparison
equal deleted inserted replaced
3897:83e8803e1cf1 3902:9c4847b93d3c
362 return caps 362 return caps
363 363
364 def commit(self, *args, **kwargs): 364 def commit(self, *args, **kwargs):
365 backup = self.ui.backupconfig('ui', 'allowemptycommit') 365 backup = self.ui.backupconfig('ui', 'allowemptycommit')
366 try: 366 try:
367 if repo.currenttopic != repo['.'].topic(): 367 if self.currenttopic != self['.'].topic():
368 # bypass the core "nothing changed" logic 368 # bypass the core "nothing changed" logic
369 self.ui.setconfig('ui', 'allowemptycommit', True) 369 self.ui.setconfig('ui', 'allowemptycommit', True)
370 return super(topicrepo, self).commit(*args, **kwargs) 370 return super(topicrepo, self).commit(*args, **kwargs)
371 finally: 371 finally:
372 self.ui.restoreconfig(backup) 372 self.ui.restoreconfig(backup)
373 373
374 def commitctx(self, ctx, error=None): 374 def commitctx(self, ctx, error=None):
375 topicfilter = topicmap.topicfilter(self.filtername) 375 topicfilter = topicmap.topicfilter(self.filtername)
376 if topicfilter != self.filtername: 376 if topicfilter != self.filtername:
377 other = repo.filtered(topicmap.topicfilter(repo.filtername)) 377 other = self.filtered(topicmap.topicfilter(self.filtername))
378 other.commitctx(ctx, error=error) 378 other.commitctx(ctx, error=error)
379 379
380 if isinstance(ctx, context.workingcommitctx): 380 if isinstance(ctx, context.workingcommitctx):
381 current = self.currenttopic 381 current = self.currenttopic
382 if current: 382 if current:
407 # overwritten at the instance level by topicmap.py 407 # overwritten at the instance level by topicmap.py
408 _autobranchmaptopic = True 408 _autobranchmaptopic = True
409 409
410 def branchmap(self, topic=None): 410 def branchmap(self, topic=None):
411 if topic is None: 411 if topic is None:
412 topic = getattr(repo, '_autobranchmaptopic', False) 412 topic = getattr(self, '_autobranchmaptopic', False)
413 topicfilter = topicmap.topicfilter(self.filtername) 413 topicfilter = topicmap.topicfilter(self.filtername)
414 if not topic or topicfilter == self.filtername: 414 if not topic or topicfilter == self.filtername:
415 return super(topicrepo, self).branchmap() 415 return super(topicrepo, self).branchmap()
416 return self.filtered(topicfilter).branchmap() 416 return self.filtered(topicfilter).branchmap()
417 417
435 tr = super(topicrepo, self).transaction(desc, *a, **k) 435 tr = super(topicrepo, self).transaction(desc, *a, **k)
436 if desc in ('strip', 'repair') or ctr is not None: 436 if desc in ('strip', 'repair') or ctr is not None:
437 return tr 437 return tr
438 438
439 reporef = weakref.ref(self) 439 reporef = weakref.ref(self)
440 if repo.ui.configbool('experimental', 'enforce-single-head'): 440 if self.ui.configbool('experimental', 'enforce-single-head'):
441 origvalidator = tr.validator 441 origvalidator = tr.validator
442 442
443 def validator(tr2): 443 def validator(tr2):
444 repo = reporef() 444 repo = reporef()
445 flow.enforcesinglehead(repo, tr2) 445 flow.enforcesinglehead(repo, tr2)
446 origvalidator(tr2) 446 origvalidator(tr2)
447 tr.validator = validator 447 tr.validator = validator
448 448
449 topicmodeserver = repo.ui.config('experimental', 449 topicmodeserver = self.ui.config('experimental',
450 'topic-mode.server', 'ignore') 450 'topic-mode.server', 'ignore')
451 ispush = (desc.startswith('push') or desc.startswith('serve')) 451 ispush = (desc.startswith('push') or desc.startswith('serve'))
452 if (topicmodeserver != 'ignore' and ispush): 452 if (topicmodeserver != 'ignore' and ispush):
453 origvalidator = tr.validator 453 origvalidator = tr.validator
454 454
456 repo = reporef() 456 repo = reporef()
457 flow.rejectuntopicedchangeset(repo, tr2) 457 flow.rejectuntopicedchangeset(repo, tr2)
458 return origvalidator(tr2) 458 return origvalidator(tr2)
459 tr.validator = validator 459 tr.validator = validator
460 460
461 elif (repo.ui.configbool('experimental', 'topic.publish-bare-branch') 461 elif (self.ui.configbool('experimental', 'topic.publish-bare-branch')
462 and (desc.startswith('push') 462 and (desc.startswith('push')
463 or desc.startswith('serve')) 463 or desc.startswith('serve'))
464 ): 464 ):
465 origclose = tr.close 465 origclose = tr.close
466 trref = weakref.ref(tr) 466 trref = weakref.ref(tr)