[blivet:master 2/3] Don't run test if the git branch is dirty

Anne Mulhern amulhern at redhat.com
Fri Mar 28 16:57:50 UTC 2014





----- Original Message -----
> From: "Vratislav Podzimek" <vpodzime at redhat.com>
> To: "anaconda patch review" <anaconda-patches at lists.fedorahosted.org>
> Sent: Friday, March 28, 2014 4:43:23 AM
> Subject: Re: [blivet:master 2/3] Don't run test if the git branch is dirty
> 
> On Thu, 2014-03-27 at 12:45 -0400, mulhern wrote:
> > Signed-off-by: mulhern <amulhern at redhat.com>
> > ---
> >  scripts/pylintcodediff | 26 ++++++++++++++++++++++++++
> >  1 file changed, 26 insertions(+)
> > 
> > diff --git a/scripts/pylintcodediff b/scripts/pylintcodediff
> > index 89bfefe..0bf59e0 100755
> > --- a/scripts/pylintcodediff
> > +++ b/scripts/pylintcodediff
> > @@ -31,6 +31,9 @@ def make_parser(parser):
> >      parser.add_argument('--branch',
> >         default='pylint-code-diff-test',
> >         help='name of test branch')
> > +    parser.add_argument('--force',
> > +       action='store_true',
> > +       help='run anyway')
> >      parser.add_argument('--pylint-log',
> >         default='pylint-log',
> >         help='path to pylint log')
> > @@ -111,6 +114,24 @@ def diff_quality(pylint_file):
> >  
> >      print(stdoutdata)
> >  
> > +def clean():
> > +    """ Checks whether git detects some changes in the current branch.
> > +
> > +        :return: True if git finds no changes, otherwise False
> > +        :rtype: bool
> > +    """
> > +    command = [ 'git', 'diff-index', '--exit-code', '--cached', 'HEAD' ]
> > +    (stdoutdata, stderrdata, ret) = run_command(command)
> > +    if ret != 0:
> > +        return False
> > +
> > +    command = [ 'git', 'diff-files', '--exit-code' ]
> > +    (stdoutdata, stderrdata, ret) = run_command(command)
> > +    if ret != 0:
> > +        return False
> > +
> > +    return True
> > +
> >  def main():
> >      parser = argparse.ArgumentParser(description="Find pylint messages
> >      related to changes subsequent to given commit.")
> >      make_parser(parser)
> > @@ -119,6 +140,11 @@ def main():
> >  
> >      branch = args.branch
> >      commit = args.commit
> > +    force = args.force
> > +
> > +    if not force and not clean():
> > +        sys.exit("Your working branch has some changes that may be lost
> > while running this test. Use the --force flag to proceed anyway.")
> Please split this line into multiple shorter lines.
> 
> ACK otherwise.
> 
> --
> Vratislav Podzimek
> 
> Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

Split in working copy.

- mulhern


More information about the anaconda-patches mailing list