Print this page
10328 git pbchk falls over with no changesets

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/scripts/git-pbchk.py
          +++ new/usr/src/tools/scripts/git-pbchk.py
↓ open down ↓ 117 lines elided ↑ open up ↑
 118  118      tracked.  If not, default to origin/master."""
 119  119  
 120  120      if not branch:
 121  121          return None
 122  122  
 123  123      p = git(["for-each-ref", "--format=%(refname:short) %(upstream:short)",
 124  124              "refs/heads/"])
 125  125  
 126  126      if not p:
 127  127          sys.stderr.write("Failed finding git parent branch\n")
 128      -        sys.exit(err)
      128 +        sys.exit(1)
 129  129  
 130  130      for line in p:
 131  131          # Git 1.7 will leave a ' ' trailing any non-tracking branch
 132  132          if ' ' in line and not line.endswith(' \n'):
 133  133              local, remote = line.split()
 134  134              if local == branch:
 135  135                  return remote
 136  136      return 'origin/master'
 137  137  
 138  138  def git_comments(parent):
 139  139      """Return a list of any checkin comments on this git branch"""
 140  140  
 141  141      p = git('log --pretty=tformat:%%B:SEP: %s..' % parent)
 142  142  
 143  143      if not p:
 144      -        sys.stderr.write("Failed getting git comments\n")
 145      -        sys.exit(err)
      144 +        sys.stderr.write("No outgoing changesets found - missing -p option?\n");
      145 +        sys.exit(1)
 146  146  
 147  147      return [x.strip() for x in p if x != ':SEP:\n']
 148  148  
 149  149  def git_file_list(parent, paths=None):
 150  150      """Return the set of files which have ever changed on this branch.
 151  151  
 152  152      NB: This includes files which no longer exist, or no longer actually
 153  153      differ."""
 154  154  
 155  155      p = git("log --name-only --pretty=format: %s.. %s" %
 156  156               (parent, ' '.join(paths)))
 157  157  
 158  158      if not p:
 159  159          sys.stderr.write("Failed building file-list from git\n")
 160      -        sys.exit(err)
      160 +        sys.exit(1)
 161  161  
 162  162      ret = set()
 163  163      for fname in p:
 164  164          if fname and not fname.isspace() and fname not in ret:
 165  165              ret.add(fname.strip())
 166  166  
 167  167      return ret
 168  168  
 169  169  def not_check(root, cmd):
 170  170      """Return a function which returns True if a file given as an argument
↓ open down ↓ 222 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX