public TreeViewItem( TreeEntryChanges change ) { name = new FileInfo( change.Path ).Name; path = change.Path; status = change.Status.ToString(); patchDiff = change.Patch; }
private void buildTreeView( TreeEntryChanges change ) { int index = change.Path.LastIndexOf( "\\" ); string folder = ( index >= 0 ) ? change.Path.Substring( 0, index ) : "\\"; TreeViewNode node = new TreeViewNode( folder.Trim() ); TreeViewItem item = new TreeViewItem( change ); treeView.tryAdd( node ).tryAdd( item ); }
private void ReplaceIndexEntryWith(TreeEntryChanges treeEntryChanges) { var indexEntry = new GitIndexEntry { Mode = (uint)treeEntryChanges.OldMode, Id = treeEntryChanges.OldOid.Oid, Path = StrictFilePathMarshaler.FromManaged(treeEntryChanges.OldPath), }; Proxy.git_index_add(handle, indexEntry); EncodingMarshaler.Cleanup(indexEntry.Path); }
private void ReplaceIndexEntryWith(TreeEntryChanges treeEntryChanges) { var indexEntry = new GitIndexEntry { Mode = (uint)treeEntryChanges.OldMode, oid = treeEntryChanges.OldOid.Oid, Path = FilePathMarshaler.FromManaged(treeEntryChanges.OldPath), }; Proxy.git_index_add(handle, indexEntry); Marshal.FreeHGlobal(indexEntry.Path); }
private void AddFileChange(GitDiffDelta delta) { var treeEntryChanges = new TreeEntryChanges(delta); changes.Add(treeEntryChanges.Path, new PatchEntryChanges(delta.IsBinary(), treeEntryChanges)); }
public static FileStatusViewModel FromTreeEntryChange(TreeEntryChanges changes) { return new FileStatusViewModel() { Path = changes.Path, State = GetState(changes.Status) }; }
private unsafe void AddFileChange(git_diff_delta *delta) { var treeEntryChanges = new TreeEntryChanges(delta); changes.Add(treeEntryChanges.Path, new PatchEntryChanges(delta->flags.HasFlag(GitDiffFlags.GIT_DIFF_FLAG_BINARY), treeEntryChanges)); }
private static byte[] GetOldVersion(Commit commit, TreeEntryChanges change) { return ((Blob)commit.Parents.First()[change.OldPath].Target).Content; }
private static byte[] GetNewVersion(Commit commit, TreeEntryChanges change) { return ((Blob)commit[change.Path].Target).Content; }
bool IgnoreTreeChange(TreeEntryChanges treeChange) { if (treeChange.Status == ChangeKind.Unmodified) { return true; } var path = treeChange.Path.Split("\\/".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); // ignore changes in the repository outside of the "Snapshot" directory var dirName = path.First(); if (!StringComparer.InvariantCultureIgnoreCase.Equals(dirName, GitBasedFileSystemSnapshot.SnapshotDirectoryName)) { return true; } // ignore directory property files var fileName = path.Last(); if (StringComparer.InvariantCultureIgnoreCase.Equals(fileName, DirectoryPropertiesFile.FileName)) { return true; } return false; }
private void detectarColoreado(TreeEntryChanges cambio) { List<int> lineasVerdes = new List<int>(); List<int> lineasRojas = new List<int>(); string strCambios = cambio.Patch; int numlinea = 0; String linea = ""; bool paraEscritura = false; for (int i = 0; i < strCambios.Length - 1; i++) { char c = strCambios[i]; if (c.ToString() == "@" && strCambios[i + 1].ToString() == "@") { paraEscritura = !paraEscritura; } if (((int)c) != 10) { if (paraEscritura == false) { linea += c.ToString(); } } else { if (linea[0].ToString() == "-") { Console.ForegroundColor = ConsoleColor.Red; lineasRojas.Add(numlinea); } if (linea[0].ToString() == "+") { Console.ForegroundColor = ConsoleColor.Green; lineasVerdes.Add(numlinea); } linea = linea.Replace("@@", ""); Console.WriteLine(linea); linea = ""; numlinea++; // Console.ForegroundColor = normal; } } //txt.SelectAll(); numlinea++; txt.CaretPosition = txt.CaretPosition.DocumentStart; for (int nlinea = 0; nlinea < numlinea; nlinea++) { txt.LineDown(); if (lineasVerdes.Contains(nlinea)) { colorearLinea(nlinea, Colors.Green); } else if (lineasRojas.Contains(nlinea)) { colorearLinea(nlinea, Colors.Red); } else colorearLinea(nlinea, Colors.Gray); } /*foreach (int n in lineasRojas) { colorearRojaLinea(n); }*/ }