about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-07-29T10·53+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-07-29T10·53+0000
commitdc14a3de46ee08a28158a886b6abba2c4144f6cd (patch)
tree3d08099f925ea93db90cbdc3a27d58af1bbf7ab2
parent79ba0431db223c1c08b46e8f3d1819e3457f21a0 (diff)
* Nicer dot graphs.
-rw-r--r--src/nix.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nix.cc b/src/nix.cc
index e9f04ff59d74..a7bcf7268413 100644
--- a/src/nix.cc
+++ b/src/nix.cc
@@ -185,7 +185,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
                     
                     FState fs = parseFState(termFromId(id));
 
-                    string label;
+                    string label, shape;
                     
                     if (fs.type == FState::fsDerive) {
                         for (FSIds::iterator i = fs.derive.inputs.begin();
@@ -197,6 +197,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
                         }
 
                         label = "derive";
+                        shape = "box";
                         for (StringPairs::iterator i = fs.derive.env.begin();
                              i != fs.derive.env.end(); i++)
                             if (i->first == "name") label = i->second;
@@ -204,12 +205,17 @@ static void opQuery(Strings opFlags, Strings opArgs)
 
                     else if (fs.type == FState::fsSlice) {
                         label = baseNameOf((*fs.slice.elems.begin()).path);
+                        shape = "ellipse";
+                        if (isHash(string(label, 0, Hash::hashSize * 2)) && 
+                            label[Hash::hashSize * 2] == '-')
+                            label = string(label, Hash::hashSize * 2 + 1);
                     }
 
                     else abort();
 
                     cout << dotQuote(id) << "[label = "
                          << dotQuote(label)
+                         << ", shape = " << shape
                          << "];\n";
                 }
             }