def report(co_label): license = get_checkout_license(co_label) reasons = because[co_label] header = '* %-*s is %r, but is implicitly GPL because:'%(maxlen, co_label, license) print wrap(header, subsequent_indent=' ') print for reason in sorted(reasons): print ' - %s'%reason print
def report(co_label): license = get_checkout_license(co_label) reasons = because[co_label] header = '* %-*s is %r, but is implicitly GPL because:' % ( maxlen, co_label, license) print wrap(header, subsequent_indent=' ') print for reason in sorted(reasons): print ' - %s' % reason print
def _git_describe_long(self, co_leaf, orig_revision, force=False, verbose=True): """ This returns a "pretty" name for the revision, but only if there are annotated tags in its history. """ retcode, revision = utils.run2('git describe --long', show_command=False) if retcode: if revision: text = utils.indent(revision.strip(), ' ') if force: if verbose: print "'git describe --long' had problems with checkout" \ " '%s'"%co_leaf print " %s" % text print "using original revision %s" % orig_revision return orig_revision else: text = ' (it failed with return code %d)' % retcode raise GiveUp("%s\n%s" % (utils.wrap( "%s: 'git describe --long'" " could not determine a revision id for checkout:" % co_leaf), text)) return revision.strip()
def _calculate_revision(self, co_leaf, orig_revision, force=False, before=None, verbose=True): """ This returns a bare SHA1 object name for the current HEAD NB: if 'before' is specified, 'force' is ignored. """ if before: print "git rev-list -n 1 --before='%s' HEAD" % before retcode, revision = utils.run2( "git rev-list -n 1 --before='%s' HEAD" % before, show_command=False) print retcode, revision if retcode: if revision: text = utils.indent(revision.strip(), ' ') else: text = ' (it failed with return code %d)' % retcode raise GiveUp("%s\n%s" % (utils.wrap( "%s:" " \"git rev-list -n 1 --before='%s' HEAD\"'" " could not determine a revision id for checkout:" % (co_leaf, before)), text)) else: retcode, revision = utils.run2('git rev-parse HEAD', show_command=False) if retcode: if revision: text = utils.indent(revision.strip(), ' ') if force: if verbose: print "'git rev-parse HEAD' had problems with checkout" \ " '%s'"%co_leaf print " %s" % text print "using original revision %s" % orig_revision return orig_revision else: text = ' (it failed with return code %d)' % retcode raise GiveUp("%s\n%s" % (utils.wrap( "%s: 'git rev-parse HEAD'" " could not determine a revision id for checkout:" % co_leaf), text)) return revision.strip()
def _calculate_revision(self, co_leaf, orig_revision): """ This returns a bare SHA1 object name for orig_revision NB: if 'before' is specified, 'force' is ignored. """ retcode, revision, ignore = utils.run3('git rev-parse %s'%orig_revision) if retcode: if revision: text = utils.indent(revision.strip(),' ') raise GiveUp("%s\n%s"%(utils.wrap("%s: 'git rev-parse HEAD'" " could not determine a revision id for checkout:"%co_leaf), text)) else: raise GiveUp("%s\n"%(utils.wrap("%s: 'git rev-parse HEAD'" " could not determine a revision id for checkout:"%co_leaf))) return revision.strip()
def _calculate_revision(self, co_leaf, orig_revision): """ This returns a bare SHA1 object name for orig_revision NB: if 'before' is specified, 'force' is ignored. """ retcode, revision, ignore = utils.run3('git rev-parse %s' % orig_revision) if retcode: if revision: text = utils.indent(revision.strip(), ' ') raise GiveUp("%s\n%s" % (utils.wrap( "%s: 'git rev-parse HEAD'" " could not determine a revision id for checkout:" % co_leaf), text)) else: raise GiveUp("%s\n" % (utils.wrap( "%s: 'git rev-parse HEAD'" " could not determine a revision id for checkout:" % co_leaf))) return revision.strip()
def _calculate_revision(self, co_leaf, orig_revision, force=False, before=None, verbose=True): """ This returns a bare SHA1 object name for the current HEAD NB: if 'before' is specified, 'force' is ignored. """ if before: print "git rev-list -n 1 --before='%s' HEAD"%before retcode, revision = utils.run2("git rev-list -n 1 --before='%s' HEAD"%before, show_command=False) print retcode, revision if retcode: if revision: text = utils.indent(revision.strip(),' ') else: text = ' (it failed with return code %d)'%retcode raise GiveUp("%s\n%s"%(utils.wrap("%s:" " \"git rev-list -n 1 --before='%s' HEAD\"'" " could not determine a revision id for checkout:"%(co_leaf, before)), text)) else: retcode, revision = utils.run2('git rev-parse HEAD', show_command=False) if retcode: if revision: text = utils.indent(revision.strip(),' ') if force: if verbose: print "'git rev-parse HEAD' had problems with checkout" \ " '%s'"%co_leaf print " %s"%text print "using original revision %s"%orig_revision return orig_revision else: text = ' (it failed with return code %d)'%retcode raise GiveUp("%s\n%s"%(utils.wrap("%s: 'git rev-parse HEAD'" " could not determine a revision id for checkout:"%co_leaf), text)) return revision.strip()
def as_str(self, fs_relative=None): """Report ourself, but present the file system name relative to 'fs_relative' """ if fs_relative and self.fs_name: fs_path = os.path.relpath(self.fs_name, fs_relative) else: fs_path = self.fs_name parts = [] parts.append(self.name) parts.append(" fs=%s"%fs_path) parts.append(" mode=%07o, uid=%d, gid=%d"%(self.mode, self.uid, self.gid)) if self.children: parts.append(utils.wrap(" kids=%s"%(", ".join(map(lambda x: x.name, self.children))), subsequent_indent=' ')) return "\n".join(parts)
def as_str(self, fs_relative=None): """Report ourself, but present the file system name relative to 'fs_relative' """ if fs_relative and self.fs_name: fs_path = os.path.relpath(self.fs_name, fs_relative) else: fs_path = self.fs_name parts = [] parts.append(self.name) parts.append(" fs=%s" % fs_path) parts.append(" mode=%07o, uid=%d, gid=%d" % (self.mode, self.uid, self.gid)) if self.children: parts.append( utils.wrap(" kids=%s" % (", ".join(map(lambda x: x.name, self.children))), subsequent_indent=' ')) return "\n".join(parts)
def _git_describe_long(self, co_leaf, orig_revision, force=False, verbose=True): """ This returns a "pretty" name for the revision, but only if there are annotated tags in its history. """ retcode, revision = utils.run2('git describe --long', show_command=False) if retcode: if revision: text = utils.indent(revision.strip(),' ') if force: if verbose: print "'git describe --long' had problems with checkout" \ " '%s'"%co_leaf print " %s"%text print "using original revision %s"%orig_revision return orig_revision else: text = ' (it failed with return code %d)'%retcode raise GiveUp("%s\n%s"%(utils.wrap("%s: 'git describe --long'" " could not determine a revision id for checkout:"%co_leaf), text)) return revision.strip()