# # # patch "Makefile.am" # from [8a2970c1e088add1fbe734467c1962d5d9928f46] # to [16a55e7e76eefc7cee9d0e83dcc63dbced0f0153] # # patch "asciik.cc" # from [fdf21f2b6ab317e2d7927e1ac324b43b0d8a7b74] # to [ad1fba357133cff5ea31de4080e297fcf0606f36] # ============================================================ --- Makefile.am 8a2970c1e088add1fbe734467c1962d5d9928f46 +++ Makefile.am 16a55e7e76eefc7cee9d0e83dcc63dbced0f0153 @@ -70,6 +70,7 @@ MOST_SOURCES = \ roster_delta.cc roster_delta.hh \ sha1.hh sha1.cc sha1_engine.hh \ rev_height.cc rev_height.hh \ + asciik.cc asciik.hh \ \ lru_writeback_cache.hh \ \ @@ -80,9 +81,7 @@ MOST_SOURCES = \ package_revision.c package_revision.h \ package_full_revision.c package_full_revision.h \ option.cc option.hh options.cc options.hh options_list.hh \ - i18n.h parallel_iter.hh safe_map.hh pch.hh \ - \ - asciik.cc asciik.hh + i18n.h parallel_iter.hh safe_map.hh pch.hh NETXX_SOURCES = \ netxx/accept.cxx netxx/accept.h netxx/address.cxx \ ============================================================ --- asciik.cc fdf21f2b6ab317e2d7927e1ac324b43b0d8a7b74 +++ asciik.cc ad1fba357133cff5ea31de4080e297fcf0606f36 @@ -194,34 +194,38 @@ asciik::draw(const size_t curr_items, co if (i == j) interline[2 * i] = '|'; else { - if (j < i) { - // | .---o - // |/| | | - // 0 1 2 3 - // j i - // 0123456 - // s e - start = 2 * j + 3; - end = 2 * i; - dot = start - 1; - interline[dot - 1] = '/'; - } else { // j > i - // o---. - // | | |\| - // 0 1 2 3 - // i j - // 0123456 - // s e - start = 2 * i + 1; - end = 2 * j - 2; - dot = end; - interline[dot + 1] = '\\'; - } - if (end > start) { - dots.insert(dot); - for (size_t l = start; l < end; ++l) - line[l] = '-'; - } + if (j < i) + { + // | .---o + // |/| | | + // 0 1 2 3 + // j i + // 0123456 + // s e + start = 2 * j + 3; + end = 2 * i; + dot = start - 1; + interline[dot - 1] = '/'; + } + else // j > i + { + // o---. + // | | |\| + // 0 1 2 3 + // i j + // 0123456 + // s e + start = 2 * i + 1; + end = 2 * j - 2; + dot = end; + interline[dot + 1] = '\\'; + } + if (end > start) + { + dots.insert(dot); + for (size_t l = start; l < end; ++l) + line[l] = '-'; + } } // prepare the proper continuation line interline2[j * 2] = '|'; @@ -291,16 +295,16 @@ asciik::try_draw(const vector::const_iterator p = parents.begin(); p != parents.end(); ++p) if (*p != ghost) - { - size_t i = curr_loc; - size_t j = distance(next_row.begin(), - find(next_row.begin(), next_row.end(), *p)); - I(j < next_items); - size_t d = abs(i - j); - if ((d > 1) && have_shift) - return false; - parent_links.insert(pair(i, j)); - } + { + size_t i = curr_loc; + size_t j = distance(next_row.begin(), + find(next_row.begin(), next_row.end(), *p)); + I(j < next_items); + size_t d = abs(i - j); + if ((d > 1) && have_shift) + return false; + parent_links.insert(pair(i, j)); + } set preservation_crosses, parent_crosses, intersection_crosses; links_cross(preservation_links, preservation_crosses); @@ -354,17 +358,18 @@ asciik::print(const revision_id & rev, c curr_row = no_ghost; else if (try_draw(next_row, curr_loc, parents, annotation)) curr_row = next_row; - else if (new_revs.size() == 0) { // this line has disappeared - vector extra_ghost(next_row); - I(curr_loc < extra_ghost.size()); - extra_ghost.insert(extra_ghost.begin() + curr_loc, ghost); - I(try_draw(extra_ghost, curr_loc, parents, annotation)); - curr_row = extra_ghost; - } + else if (new_revs.size() == 0) // this line has disappeared + { + vector extra_ghost(next_row); + I(curr_loc < extra_ghost.size()); + extra_ghost.insert(extra_ghost.begin() + curr_loc, ghost); + I(try_draw(extra_ghost, curr_loc, parents, annotation)); + curr_row = extra_ghost; + } } -CMD(asciik, N_("tree"), N_("SELECTOR"), - N_("prints ASCII-art tree representation"), options::opts::none) +CMD(asciik, N_("debug"), N_("SELECTOR"), + N_("prints an ASCII-art tree representation"), options::opts::none) { N(args.size() == 1, F("wrong argument count"));