hgext/bookflow.py
changeset 43076 2372284d9457
parent 41031 b53c5651fcf6
child 43077 687b865b95ad
--- a/hgext/bookflow.py	Sat Oct 05 10:29:34 2019 -0400
+++ b/hgext/bookflow.py	Sun Oct 06 09:45:02 2019 -0400
@@ -36,20 +36,26 @@
 cmdtable = {}
 command = registrar.command(cmdtable)
 
+
 def commit_hook(ui, repo, **kwargs):
     active = repo._bookmarks.active
     if active:
         if active in ui.configlist(MY_NAME, 'protect'):
             raise error.Abort(
-                _('cannot commit, bookmark %s is protected') % active)
+                _('cannot commit, bookmark %s is protected') % active
+            )
         if not cwd_at_bookmark(repo, active):
             raise error.Abort(
-       _('cannot commit, working directory out of sync with active bookmark'),
-                hint=_("run 'hg up %s'") % active)
+                _(
+                    'cannot commit, working directory out of sync with active bookmark'
+                ),
+                hint=_("run 'hg up %s'") % active,
+            )
     elif ui.configbool(MY_NAME, 'require-bookmark', True):
         raise error.Abort(_('cannot commit without an active bookmark'))
     return 0
 
+
 def bookmarks_update(orig, repo, parents, node):
     if len(parents) == 2:
         # called during commit
@@ -58,43 +64,59 @@
         # called during update
         return False
 
+
 def bookmarks_addbookmarks(
-        orig, repo, tr, names, rev=None, force=False, inactive=False):
+    orig, repo, tr, names, rev=None, force=False, inactive=False
+):
     if not rev:
         marks = repo._bookmarks
         for name in names:
             if name in marks:
-                raise error.Abort(_(
-                    "bookmark %s already exists, to move use the --rev option"
-                    ) % name)
+                raise error.Abort(
+                    _(
+                        "bookmark %s already exists, to move use the --rev option"
+                    )
+                    % name
+                )
     return orig(repo, tr, names, rev, force, inactive)
 
+
 def commands_commit(orig, ui, repo, *args, **opts):
     commit_hook(ui, repo)
     return orig(ui, repo, *args, **opts)
 
+
 def commands_pull(orig, ui, repo, *args, **opts):
     rc = orig(ui, repo, *args, **opts)
     active = repo._bookmarks.active
     if active and not cwd_at_bookmark(repo, active):
-        ui.warn(_(
-            "working directory out of sync with active bookmark, run "
-            "'hg up %s'"
-        ) % active)
+        ui.warn(
+            _(
+                "working directory out of sync with active bookmark, run "
+                "'hg up %s'"
+            )
+            % active
+        )
     return rc
 
+
 def commands_branch(orig, ui, repo, label=None, **opts):
     if label and not opts.get(r'clean') and not opts.get(r'rev'):
         raise error.Abort(
-         _("creating named branches is disabled and you should use bookmarks"),
-            hint="see 'hg help bookflow'")
+            _(
+                "creating named branches is disabled and you should use bookmarks"
+            ),
+            hint="see 'hg help bookflow'",
+        )
     return orig(ui, repo, label, **opts)
 
+
 def cwd_at_bookmark(repo, mark):
     mark_id = repo._bookmarks[mark]
     cur_id = repo.lookup('.')
     return cur_id == mark_id
 
+
 def uisetup(ui):
     extensions.wrapfunction(bookmarks, 'update', bookmarks_update)
     extensions.wrapfunction(bookmarks, 'addbookmarks', bookmarks_addbookmarks)