equal
deleted
inserted
replaced
152 extensions.wrapfunction(merge, 'update', mergeupdatewrap) |
152 extensions.wrapfunction(merge, 'update', mergeupdatewrap) |
153 cmdutil.summaryhooks.add('topic', summaryhook) |
153 cmdutil.summaryhooks.add('topic', summaryhook) |
154 |
154 |
155 |
155 |
156 def reposetup(ui, repo): |
156 def reposetup(ui, repo): |
157 orig = repo.__class__ |
|
158 if not isinstance(repo, localrepo.localrepository): |
157 if not isinstance(repo, localrepo.localrepository): |
159 return # this can be a peer in the ssh case (puzzling) |
158 return # this can be a peer in the ssh case (puzzling) |
160 |
159 |
161 class topicrepo(repo.__class__): |
160 class topicrepo(repo.__class__): |
162 |
161 |
169 backup = self.ui.backupconfig('ui', 'allowemptycommit') |
168 backup = self.ui.backupconfig('ui', 'allowemptycommit') |
170 try: |
169 try: |
171 if repo.currenttopic != repo['.'].topic(): |
170 if repo.currenttopic != repo['.'].topic(): |
172 # bypass the core "nothing changed" logic |
171 # bypass the core "nothing changed" logic |
173 self.ui.setconfig('ui', 'allowemptycommit', True) |
172 self.ui.setconfig('ui', 'allowemptycommit', True) |
174 return orig.commit(self, *args, **kwargs) |
173 return super(topicrepo, self).commit(*args, **kwargs) |
175 finally: |
174 finally: |
176 self.ui.restoreconfig(backup) |
175 self.ui.restoreconfig(backup) |
177 |
176 |
178 def commitctx(self, ctx, error=None): |
177 def commitctx(self, ctx, error=None): |
179 if isinstance(ctx, context.workingcommitctx): |
178 if isinstance(ctx, context.workingcommitctx): |
185 ctx.topic() and |
184 ctx.topic() and |
186 not self.currenttopic): |
185 not self.currenttopic): |
187 # we are amending and need to remove a topic |
186 # we are amending and need to remove a topic |
188 del ctx.extra()[constants.extrakey] |
187 del ctx.extra()[constants.extrakey] |
189 with topicmap.usetopicmap(self): |
188 with topicmap.usetopicmap(self): |
190 return orig.commitctx(self, ctx, error=error) |
189 return super(topicrepo, self).commitctx(ctx, error=error) |
191 |
190 |
192 @property |
191 @property |
193 def topics(self): |
192 def topics(self): |
194 if self._topics is not None: |
193 if self._topics is not None: |
195 return self._topics |
194 return self._topics |