src/topic/__init__.py
changeset 1858 4ab1b854ce4e
parent 1857 a506ed8ab8da
child 1859 fdfa611b8ab0
--- a/src/topic/__init__.py	Mon Jun 15 16:56:44 2015 -0500
+++ b/src/topic/__init__.py	Mon Jun 15 17:29:07 2015 -0500
@@ -44,6 +44,16 @@
 def reposetup(ui, repo):
     orig = repo.__class__
     class topicrepo(repo.__class__):
+        def commit(self, *args, **kwargs):
+            backup = self.ui.backupconfig('ui', 'allowemptycommit')
+            try:
+                if repo.currenttopic != repo['.'].extra().get('topic'):
+                    # bypass the core "nothing changed" logic
+                    self.ui.setconfig('ui', 'allowemptycommit', True)
+                return orig.commit(self, *args, **kwargs)
+            finally:
+                self.ui.restoreconfig(backup)
+
         def commitctx(self, ctx, error=None):
             if isinstance(ctx, context.workingcommitctx):
                 current = self.currenttopic