10

My team uses five separate SVN repositories, for five different modules or apps that we're maintaining. Each one has its own version sequence.

We like to have a "wall poster" of the current state of our repos with their branches. Currently, we're using a whiteboard for this, and it works well enough. But I'm wondering whether a tool exists that can help us with this? I'd be fine with having to manually update a document (Visio or whatever) but bonus points for a tool that can pull automatically from our SVN server of course.

Our whiteboard looks roughly like this: We have a main development line in the trunk ===. When a release is complete, we tag it o and create a maintenance branch --- so that we can deliver bugfix release tags o while trunk development continues.

Foo trunk:   o===dev1.0===o====dev1.1===========o====dev1.2==========
Foo 1.0.x maintenance:    |---fix1.0.1--o---    |
Foo 1.1.x maintenance:                          |--fix1.1.1--o---

Bar trunk:   o===dev1.0===o====dev1.1===========o====dev1.2==========
Bar 1.0.x maintenance:    |---fix1.0.1--o---    |
Bar 1.1.x maintenance:                          |--fix1.1.1--o---

Xyz trunk:   o===dev1.0===o====dev1.1===========o====dev1.2==========
Xyz 1.0.x maintenance:    |---fix1.0.1--o---    |
Xyz 1.1.x maintenance:                          |--fix1.1.1--o---

...

Is there a tool that could help maintain a "poster" that looks similar to this? Note that I want to make this for several repos on a server, not just for a single repo, and that I only care about the tags and not about the individual checkins.

  • 1
    Not sure if it exactly fits, but Trac has some addons for that using Graphviz to automatically visualize repos. Not sure if that could be configured to make exactly the trees you're after, but it's certainly worth a look. See e.g. its Revtree plugin (page has screenshots). – Izzy Nov 20 '14 at 6:59
  • Not an answer, as you are already using SVN and presumably stuck with it, but that is the reason that I switched our small company from SVN to Plastic SCM . "The branch explorer was created after the typical blackboard diagram that every team draws when they try to explain the merge structure of the project" - plasticscm.com/branch-explorer/index.html Perhaps this might help others who find this question and are either in a position to switch or or looking for a new VCS ... plasticscm.com/branch-explorer/assets/img/… – Mawg Nov 21 '14 at 8:14
6

TikZ

TikZ is a (La)TeX package for drawing all sorts of diagrams. I use it for most of my drawing needs. Its features include:

  • Intuitive language syntax
  • Vector graphics (so you could scale your poster to any size),
  • A huge selection of libraries,
  • Ability to define custom commands and styles
  • A detailed user manual,
  • Excellent community support on TeX.SE (most popular question tag over there with nearly 9000 questions).

Here is an example of the first part of your diagram as drawn with TikZ:


Source code for above diagram:

\documentclass[tikz,border=2pt]{standalone}
\usetikzlibrary{shapes,positioning,arrows}
\tikzstyle{revision}=[draw,circle,inner sep=2pt]
\tikzstyle{trunkline}=[draw,ultra thick,postaction={draw,thick,color=white}]

\begin{document}
\begin{tikzpicture}[node distance=1cm and 2cm]
  \node[minimum width=4cm] (footrunk) {Foo trunk:};
  \node[revision,right= of footrunk,right=5mm,fill=gray!60] (rev12345) {};
  \node[revision,right= of rev12345] (rev12346) {};
  \node[revision,right= of rev12346,right=3cm] (rev12347) {};
  \node[revision,right= of rev12347] (rev12348) {};

  \node[minimum width=4cm,below= of footrunk,above] (maintenance1) {Foo 1.0.x maintenance};
  \node[revision,below=of rev12346,above] (fix10) {};
  \node[revision,right=of fix10] (fix101) {};
  \node[minimum width=4cm,below= of maintenance1,above] (maintenance2) {Foo 1.1.x maintenance};
  \node[revision,node distance=2cm,below=of rev12347,above] (fix11) {};
  \node[revision,right=of fix11] (fix111) {};

  \draw[trunkline] (rev12345) -- node[font=\scriptsize,fill=white]{dev1.0} (rev12346);
  \draw[trunkline] (rev12346) -- node[font=\scriptsize,fill=white]{dev1.1} (rev12347);
  \draw[trunkline] (rev12347) -- node[font=\scriptsize,fill=white]{dev1.2} (rev12348);
  \draw[very thick,dotted,-stealth'] (rev12348) -- ++(1cm,0);
  \draw (rev12346) -- (fix10);
  \draw (fix10) -- node[font=\scriptsize,fill=white]{fix1.0.1} (fix101);
  \draw[thick,blue,dashed,-stealth'] (fix101) -- (rev12347);
  \draw (rev12347) -- (fix11);
  \draw (fix11) -- node[font=\scriptsize,fill=white]{fix1.1.1} (fix111);
\end{tikzpicture}
\end{document}

Edit concerning automation

To automate these diagrams, you'll have to make use of the macros in the TikZ package. Since performing mathematical operations in TikZ is still a pain, it's even better if you could use another powerful language to edit the tex file, like Perl or Python. These can also be used to extract data from your SVN log files, achieving a fully automated process.

Here is an attempt to automate the above diagram using TikZ alone with 3 input variables: First and last revs, and number of branches. Of course, this works only for this specific form of trees, but it'll serve as an example on how macros work.

main script

\documentclass[tikz,border=2pt]{standalone}
\usetikzlibrary{shapes,positioning,arrows}

% Macros
\input{svn_macros}
% Configuration
\newcommand\FirstRevNumber{12345}
\newcommand\CurrentRevNumber{12348}
\newcommand\FixCount{2}
% End of configuration

\begin{document}
\begin{tikzpicture}[node distance=1cm and 1.5cm]
  \node[minimum width=4cm] (0) {Foo trunk:};
  \firstrevision{\FirstRevNumber}{0}
  \foreach \rev [count=\counter from 0]  in {\FirstRevNumber,...,\CurrentRevNumber}{
    \pgfmathtruncatemacro{\NextRev}{\rev+1}
    \pgfmathtruncatemacro{\FixNum}{\counter+1}
    \revision{\NextRev}{\rev}\mainline{\rev}{\NextRev}{dev1.\counter}
    \ifnum\counter<\FixCount
      \node[minimum width=4cm,below= of \counter,above] (\FixNum) {Foo 1.\counter.x maintenance};
      \newfix[\FixNum]{1\counter}{\NextRev}
      \fix{1\counter1}{1\counter}
      \branchline{1\counter}{1\counter1}{fix1.\counter.1}
    \fi
  }
  \foreach \rev [count=\counter from 0]  in {\FirstRevNumber,...,\CurrentRevNumber}{
    \pgfmathtruncatemacro{\SecondNextRev}{\rev+2}
    \ifnum\counter<\FixCount
      \draw[thick,blue,dashed,-stealth'] (1\counter1) -- (\SecondNextRev);
    \fi
  }
\end{tikzpicture}
\end{document}

imported file

\newcommand\firstrevision[2]{\node[draw,circle,inner sep=2pt,right= of #2,right=5mm,fill=gray!60](#1){};}
\newcommand\revision[2]{\node[draw,circle,inner sep=2pt,right= of #2,right=2cm](#1){};}
\newcommand\newfix[3][1]{\node[draw,circle,node distance=#1cm,inner sep=2pt,below= of #3,above](#2){};\draw (#3) -- (#2);}
\newcommand\fix[2]{\node[draw,circle,inner sep=2pt,right= of #2](#1){};}
\newcommand\mainline[3]{\draw[ultra thick,postaction={draw,thick,color=white}] (#1) -- node[font=\scriptsize,fill=white]{#3} (#2);}
\newcommand\branchline[3]{\draw (#1) -- node[font=\scriptsize,fill=white]{#3} (#2);}

This would produce a similar tree to the above figure, but if you increase the numbers in the Configuration section (12345, 12360, and 8, for example), you could end up with a pretty long tree:

Result

(Click image for bigger version)

  • Thank you, recreating my diagram certainly demonstrates how well your suggestion works. It seems very structured -- now, if there'd be a way to generate this automatically, it would be perfect. – Torben Gundtofte-Bruun Nov 19 '14 at 18:38
  • @TorbenGundtofte-Bruun I'd say it's quite possible, but definitely not something one could whip up during a lengthy coffee break. Given enough time, one could define a series of macros in TeX to form a pattern of the diagrams, then write a script in a powerful programming language such as Perl or Python. It would read the data from your SVN log file and generate the corresponding picture. Maybe if you could post a sample log file that corresponds to the posted diagram, and I'll try to post an example script to read that – Tymric Nov 19 '14 at 18:58
  • Yeah, some kind of SVN file parsing is required. I'm not giving you a logfile - not because of secrecy but because I'd rather not you spend time working out a script that I could probably get into actual operation at work. – Torben Gundtofte-Bruun Nov 19 '14 at 19:21
  • @TorbenGundtofte-Bruun I edited the answer with another example that contains macros. I hope it helps – Tymric Nov 19 '14 at 22:45
  • Sorry, there was a word from my last comment! I meant: because I'd rather not you spend time working out a script that I could probably not get into actual operation at work. – Torben Gundtofte-Bruun Nov 20 '14 at 7:23
0

Since you are likely to wish/need to do this several times a week and svn log operations are often time consuming I would suggest having mercurial local repositories of the SVN repositories, (using hgsubversion), to speed things up.

Mercurial also has some very sophisticated log output facilities, (see hg help log and hg help templates for more details), that you could probably use to produce output that would be easily massaged into something like graphviz to give your graph.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.