public LogView(string filepath, bool isDirectory, RevisionDescription[] history, VersionControlSystem vc) : base(Path.GetFileName(filepath) + " Log") { this.vc = vc; this.filepath = filepath; ScrolledWindow scroller = new ScrolledWindow(); Viewport viewport = new Viewport(); VBox box = new VBox(false, 5); viewport.Add(box); scroller.Add(viewport); widget = scroller; foreach (RevisionDescription d in history) { RevItem revitem = new RevItem(); revitem.Path = d.RepositoryPath; revitem.Rev = d.Revision; VBox item = new VBox(false, 1); HBox header_row = new HBox(false, 2); item.PackStart(header_row, false, false, 0); Label header = new Label(d.Revision + " -- " + d.Time + " -- " + d.Author); header.Xalign = 0; header_row.Add(header); if (!isDirectory) { Button viewdiff = new Button("View Changes"); viewdiff.Clicked += new EventHandler(DiffButtonClicked); header_row.Add(viewdiff); buttons[viewdiff] = revitem; Button viewtext = new Button("View File"); viewtext.Clicked += new EventHandler(ViewTextButtonClicked); header_row.Add(viewtext); buttons[viewtext] = revitem; } TextView message = new TextView(); message.Editable = false; message.WrapMode = Gtk.WrapMode.WordChar; message.Buffer.Text = d.Message == "" ? "No message." : d.Message; item.PackStart(message, false, false, 0); box.PackStart(item, false, false, 0); } widget.ShowAll(); }
public override RevisionDescription[] GetHistory(string sourcefile, RevisionPtr since) { ArrayList revs = new ArrayList(); string curPath = Client.GetPathUrl(sourcefile); if (curPath == null) return null; SvnClient.Rev sincerev = SvnClient.Rev.First; if (since != null) sincerev = ((SvnRevisionPtr)since).ForApi(); foreach (SvnClient.LogEnt log in Client.Log(sourcefile, SvnClient.Rev.Head, sincerev)) { RevisionDescription d = new RevisionDescription(); d.Author = log.Author; d.Message = log.Message; d.Revision = new SvnRevisionPtr(log.Revision); d.RepositoryPath = curPath; d.Time = log.Time; revs.Add(d); // Be aware of the change in path resulting from a copy foreach (SvnClient.LogEntChangedPath chg in log.ChangedPaths) { if (curPath.EndsWith(chg.Path) && chg.CopyFromPath != null) { curPath = curPath.Substring(0, curPath.Length-chg.Path.Length) + chg.CopyFromPath; } } } return (RevisionDescription[])revs.ToArray(typeof(RevisionDescription)); }