For consistency, show [0] in the repo display instead of suppressing it. Now
authorZac Medico <zmedico@gentoo.org>
Fri, 22 Aug 2008 22:08:34 +0000 (22:08 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 22 Aug 2008 22:08:34 +0000 (22:08 -0000)
the repo display and [0] will only be suppressed when [0] is all that would
show for every package. Thanks to Joe Peterson <lavajoe@g.o> for the
suggestion.

svn path=/main/trunk/; revision=11449

pym/_emerge/__init__.py

index 59f407ddf8ce7b5d21fac0c3615f00587658e34e..c6d8c71fdc53d384a9f6886b708c730595aeb249 100644 (file)
@@ -6755,7 +6755,6 @@ class depgraph(object):
                                return ret
 
                repo_display = RepoDisplay(self.roots)
-               show_repos = False
 
                tree_nodes = []
                display_list = []
@@ -6906,6 +6905,10 @@ class depgraph(object):
                # in size display (verbose mode)
                myfetchlist=[]
 
+               # Use this set to detect when all the "repoadd" strings are "[0]"
+               # and disable the entire repo display in this case.
+               repoadd_set = set()
+
                for mylist_index in xrange(len(mylist)):
                        x, depth, ordered = mylist[mylist_index]
                        pkg_type = x[0]
@@ -7049,7 +7052,8 @@ class depgraph(object):
                                                counters.new += 1
 
                                verboseadd = ""
-                               
+                               repoadd = None
+
                                if True:
                                        # USE flag display
                                        forced_flags = set()
@@ -7169,7 +7173,7 @@ class depgraph(object):
                                                                        myfetchlist.append(myfetchfile)
                                                        if ordered:
                                                                counters.totalsize += mysize
-                                               verboseadd+=format_size(mysize)+" "
+                                               verboseadd += format_size(mysize)
 
                                        # overlay verbose
                                        # assign index for a previous version in the same slot
@@ -7184,7 +7188,6 @@ class depgraph(object):
                                                        ["repository"])[0]
 
                                        # now use the data to generate output
-                                       repoadd = None
                                        if pkg.installed or not has_previous:
                                                repoadd = repo_display.repoStr(repo_path_real)
                                        else:
@@ -7198,9 +7201,8 @@ class depgraph(object):
                                                        repoadd = "%s=>%s" % (
                                                                repo_display.repoStr(repo_path_prev),
                                                                repo_display.repoStr(repo_path_real))
-                                       if repoadd and repoadd != "0":
-                                               show_repos = True
-                                               verboseadd += teal("[%s]" % repoadd)
+                                       if repoadd:
+                                               repoadd_set.add(repoadd)
 
                                xs = [portage.cpv_getkey(pkg_key)] + \
                                        list(portage.catpkgsplit(pkg_key)[2:])
@@ -7281,6 +7283,7 @@ class depgraph(object):
                                                        myprint=myprint+darkblue(" "+xs[1]+xs[2])+" "
                                                        myprint=myprint+myoldbest
                                                        myprint=myprint+darkgreen("to "+x[1])
+                                                       verboseadd = None
                                                else:
                                                        if not pkg_merge:
                                                                myprint = "[%s] %s%s" % \
@@ -7296,21 +7299,21 @@ class depgraph(object):
                                                        if (oldlp-nc_len(myprint)) > 0:
                                                                myprint=myprint+" "*(oldlp-nc_len(myprint))
                                                        myprint=myprint+myoldbest
-                                                       myprint=myprint+darkgreen("to "+x[1])+" "+verboseadd
+                                                       myprint += darkgreen("to " + pkg.root)
                                        else:
                                                if not pkg_merge:
                                                        myprint = "[%s] " % pkgprint(pkg_status.ljust(13))
                                                else:
                                                        myprint = "[" + pkg_type + " " + addl + "] "
                                                myprint += indent + pkgprint(pkg_key) + " " + \
-                                                       myoldbest + darkgreen("to " + myroot) + " " + \
-                                                       verboseadd
+                                                       myoldbest + darkgreen("to " + myroot)
                                else:
                                        if "--columns" in self.myopts:
                                                if "--quiet" in self.myopts:
                                                        myprint=addl+" "+indent+pkgprint(pkg_cp)
                                                        myprint=myprint+" "+green(xs[1]+xs[2])+" "
                                                        myprint=myprint+myoldbest
+                                                       verboseadd = None
                                                else:
                                                        if not pkg_merge:
                                                                myprint = "[%s] %s%s" % \
@@ -7325,16 +7328,19 @@ class depgraph(object):
                                                        myprint=myprint+green(" ["+xs[1]+xs[2]+"] ")
                                                        if (oldlp-nc_len(myprint)) > 0:
                                                                myprint=myprint+(" "*(oldlp-nc_len(myprint)))
-                                                       myprint=myprint+myoldbest+"  "+verboseadd
+                                                       myprint += myoldbest
                                        else:
                                                if not pkg_merge:
-                                                       myprint = "[%s] %s%s %s %s" % \
+                                                       myprint = "[%s] %s%s %s" % \
                                                                (pkgprint(pkg_status.ljust(13)),
                                                                indent, pkgprint(pkg.cpv),
-                                                               myoldbest, verboseadd)
+                                                               myoldbest)
                                                else:
-                                                       myprint="["+pkgprint(pkg_type)+" "+addl+"] "+indent+pkgprint(pkg_key)+" "+myoldbest+" "+verboseadd
-                               p.append(myprint)
+                                                       myprint = "[%s %s] %s%s %s" % \
+                                                               (pkgprint(pkg_type), addl, indent,
+                                                               pkgprint(pkg.cpv), myoldbest)
+
+                               p.append((myprint, verboseadd, repoadd))
 
                                if "--tree" not in self.myopts and \
                                        "--quiet" not in self.myopts and \
@@ -7354,8 +7360,24 @@ class depgraph(object):
                                                        p.append(colorize("WARN", "*** Portage will stop merging at this point and reload itself,"))
                                                        p.append(colorize("WARN", "    then resume the merge."))
 
+               out = sys.stdout
+               show_repos = repoadd_set != set(["0"])
+
                for x in p:
-                       print x
+                       if isinstance(x, basestring):
+                               out.write("%s\n" % (x,))
+                               continue
+
+                       myprint, verboseadd, repoadd = x
+
+                       if verboseadd:
+                               myprint += " " + verboseadd
+
+                       if show_repos:
+                               myprint += " " + teal("[%s]" % repoadd)
+
+                       out.write("%s\n" % (myprint,))
+
                for x in blockers:
                        print x