tg-revert.sh: accept hash names when reverting
[topgit/pro.git] / leaves.awk
blob7cd03e2d549c67b49997b4bb61066b4019a23ab5
1 function first(A, i)
3 for(i in A) {
4 delete A[i];
5 return i;
7 return 0;
10 if (dir == "push")
11 tree[$2] = tree[$2] " " $1;
12 else
13 tree[$1] = tree[$1] " " $2;
15 END {
16 queue[start] = 1;
17 while(1)
19 candidate = first(queue);
20 if(!candidate)
21 break;
22 if(candidate in processed)
23 continue;
24 processed[candidate] = 1;
25 if(candidate in tree)
27 new_candidates = tree[candidate];
28 split(new_candidates, tmp);
29 for(c in tmp)
30 queue[tmp[c]] = 1;
32 else
34 leaves[candidate] = 1;
37 for(leave in leaves)
38 print leave;