comparison hgext3rd/topic/__init__.py @ 4842:ee0866a279da stable

topic: fix some API to make it more robust The new code can deal with changes in upstream mercurial.
author Valentin Gatien-Baron <vgatien-baron@janestreet.com>
date Fri, 13 Sep 2019 16:04:32 +0200
parents f5047e38f683
children 6f5d3f58fbe4
comparison
equal deleted inserted replaced
4841:95d2b5440731 4842:ee0866a279da
391 self.ui.setconfig('ui', 'allowemptycommit', True) 391 self.ui.setconfig('ui', 'allowemptycommit', True)
392 return super(topicrepo, self).commit(*args, **kwargs) 392 return super(topicrepo, self).commit(*args, **kwargs)
393 finally: 393 finally:
394 self.ui.restoreconfig(backup) 394 self.ui.restoreconfig(backup)
395 395
396 def commitctx(self, ctx, error=None): 396 def commitctx(self, ctx, *args, **kwargs):
397 topicfilter = topicmap.topicfilter(self.filtername) 397 topicfilter = topicmap.topicfilter(self.filtername)
398 if topicfilter != self.filtername: 398 if topicfilter != self.filtername:
399 other = self.filtered(topicmap.topicfilter(self.filtername)) 399 other = self.filtered(topicmap.topicfilter(self.filtername))
400 other.commitctx(ctx, error=error) 400 other.commitctx(ctx, *args, **kwargs)
401 401
402 if isinstance(ctx, context.workingcommitctx): 402 if isinstance(ctx, context.workingcommitctx):
403 current = self.currenttopic 403 current = self.currenttopic
404 if current: 404 if current:
405 ctx.extra()[constants.extrakey] = current 405 ctx.extra()[constants.extrakey] = current
407 and ctx.extra().get('amend_source') 407 and ctx.extra().get('amend_source')
408 and ctx.topic() 408 and ctx.topic()
409 and not self.currenttopic): 409 and not self.currenttopic):
410 # we are amending and need to remove a topic 410 # we are amending and need to remove a topic
411 del ctx.extra()[constants.extrakey] 411 del ctx.extra()[constants.extrakey]
412 return super(topicrepo, self).commitctx(ctx, error=error) 412 return super(topicrepo, self).commitctx(ctx, *args, **kwargs)
413 413
414 @property 414 @property
415 def topics(self): 415 def topics(self):
416 if self._topics is not None: 416 if self._topics is not None:
417 return self._topics 417 return self._topics