Who we are

We are the developers of Plastic SCM, a full version control stack (not a Git variant). We work on the strongest branching and merging you can find, and a core that doesn't cringe with huge binaries and repos. We also develop the GUIs, mergetools and everything needed to give you the full version control stack.

If you want to give it a try, download it from here.

We also code SemanticMerge, and the gmaster Git client.

Gource for Plastic SCM

Thursday, April 08, 2010 Pablo Santos 1 Comments

David just sent me the following code to make gource work with Plastic.

Build it and create a pgource.exe and then type (all in one line)


$ cm log -f=0 --allbranches
--csFormat="{items}"
--itemformat=
"{date}|{owner}|{shortstatus}
|{path}{newline}"
| pgource.exe > p.log


Now you've a gource ready log! Just play it and enjoy


$ gource p.log





using System;
using System.Collections;
using System.Globalization;

namespace pgource
{
class Class1
{
private static string mCulture = "en-us";
private static Stack mReversedLines = new Stack();

[STAThread]
static void Main(string[] args)
{
ProcessArgs(args);
ReadInput();
PrintOutput();
}

private static void ProcessArgs(string[] args)
{
if (args.Length == 1) mCulture = args[0];
}

private static void ReadInput()
{
string line;

while ( (line = Console.ReadLine()) != null)
{
ProcessLine(line);
}
}

private static void ProcessLine(string line)
{
if (line == string.Empty) return;

string[] parts = line.Split('|');

if (parts.Length != 4) return;

ProcessParts(parts);
}

private static void ProcessParts(string[] parts)
{
// 3/28/2010 9:10:22 PM|dave|C|c:\develop\Form1.resx

mReversedLines.Push(string.Format("{0}|{1}|{2}|{3}",
GetUnixDate(parts[0]),
parts[1],
GetStatus(parts[2]),
GetPath(parts[3])));
}

private static int GetUnixDate(string date)
{
CultureInfo c = new CultureInfo(mCulture);

DateTime parsedDate = DateTime.Parse(date, c, DateTimeStyles.None);

return (int)((parsedDate - new DateTime(1970, 1, 1)).TotalSeconds);
}

private static string GetStatus(string status)
{
switch (status)
{
case "A": return "A";
case "R": return "D";
default: return "M";
}
}

private static string GetPath(string path)
{
return path.Replace('\\', '/').Replace(':', '_');
}

private static void PrintOutput()
{
while (mReversedLines.Count > 0)
{
Console.WriteLine(mReversedLines.Pop() as string);
}
}
}
}



Pablo Santos
I'm the CTO and Founder at Códice.
I've been leading Plastic SCM since 2005. My passion is helping teams work better through version control.
I had the opportunity to see teams from many different industries at work while I helped them improving their version control practices.
I really enjoy teaching (I've been a University professor for 6+ years) and sharing my experience in talks and articles.
And I love simple code. You can reach me at @psluaces.

1 comment:

  1. Wow, cool, nice effects!
    "source control made alive!" ;-)

    ReplyDelete