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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/3/13 Karl Hasselström <kha@xxxxxxxxxxx>:
> On 2009-03-12 12:08:56 +0000, Catalin Marinas wrote:
>> +    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)])

I added two separate if's as I don't find the above readable :-)

if not iw.worktree_clean():
    self.__halt('Worktree not clean. Use "refresh" or "status --reset"')
if not iw.index.is_clean(self.stack.head):
    self.__halt('Index not clean. Use "refresh" or "status --reset"')
def __checkout(self, tree, iw, allow_bad_head):

-- 
Catalin
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux