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 );
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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)
     };
 }
Esempio n. 7
0
        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));
        }
Esempio n. 8
0
 private static byte[] GetOldVersion(Commit commit, TreeEntryChanges change)
 {
     return ((Blob)commit.Parents.First()[change.OldPath].Target).Content;
 }
Esempio n. 9
0
 private static byte[] GetNewVersion(Commit commit, TreeEntryChanges change)
 {
     return ((Blob)commit[change.Path].Target).Content;
 }
Esempio n. 10
0
        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;

        }
Esempio n. 11
0
        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);
            }*/
        }