Thread (19 messages) flat view 19 messages, 3 authors, 2016-06-15

Re: [StGit PATCH 1/5] Check for local changes with "goto"

From: Karl Hasselström <hidden>
Date: 2016-06-15 22:46:23

On 2009-03-12 12:08:56 +0000, Catalin Marinas wrote:
This is done by default, unless the --keep option is passed, for
consistency with the "pop" command. The index is checked in the
Transaction.run() function so that other commands could benefit from
this feature (off by default).

This behaviour can be overridden by setting the stgit.autokeep option.
Two small nits; otherwise,

  Acked-by: Karl Hasselström [off-list ref]
-    trans = transaction.StackTransaction(stack, 'goto')
+    clean_iw = not options.keep and iw or None
Add some parentheses here, please! I know that "and" binds tighter
than "or", but I have to think for too long to remember which is
which, and I'll bet I'm not alone ...
+    def __assert_index_worktree_clean(self, iw):
+        if not iw.worktree_clean() or \
+           not iw.index.is_clean(self.stack.head):
+            self.__halt('Repository not clean. Use "refresh" or '
+                        '"status --reset"')
"Repository" is misleading here. Maybe something like

   ix_c = iw.index.is_clean(self.stack.head)
   wt_c = iw.worktree_clean()
   if not ix_c or not wt_c:
       self.__halt('%s not clean. Use "refresh" or "status --reset"'
                   % { (False, True): 'Index', (True, False): 'Worktree',
                       (False, False): 'Index and worktree' }[(ix_c, wt_c)])

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help