public void TreeDiffTest1()
 {
     RepositoryGraph repo = new RepositoryGraph(repodir);
     var changes = repo.GetChanges("master");
     foreach (var change in changes)
     {
         Console.WriteLine("{0}:{1}", change.ChangeType, change.Name);
     }
 }
 public void TreeDiffTest()
 {
     RepositoryGraph repo = new RepositoryGraph(repodir);
     var changes = repo.GetChanges(Constants.MASTER, Constants.HEAD);
     foreach (var change in changes)
     {
         Console.WriteLine("{0}:{1}", change.ChangeType, change.Name);
     }
 }
        public void Refresh()
        {
            this.index = null;
            this.commitTree = null;

            this.cache.Clear();
            this.changedFiles = null;
            this.repositoryGraph = null;
            this.dirCache = null;
            this.head = null;
            this.ignoreRules = null;
            this.remotes = null;
            this.configs = null;
            if (!string.IsNullOrEmpty(initFolder))
            {
                try
                {
                    this.repository = Open(new DirectoryInfo(initFolder));
                    if (this.repository != null)
                    {
                        dirCache = repository.ReadDirCache();
                        head = repository.Resolve(Constants.HEAD);

                        if (head == null)
                        {
                            this.commitTree = new Tree(repository);
                        }
                        else
                        {
                            var treeId = ObjectId.FromString(repository.Open(head).GetBytes(), 5);
                            this.commitTree = new Tree(repository, treeId, repository.Open(treeId).GetBytes());
                        }

                        if (repository.IsBare)
                            throw new NoWorkTreeException();

                        this.index = new GitIndex(repository);
                        this.index.Read();
                        this.index.RereadIfNecessary();

                        try
                        {
                            //load local .gitignore file
                            var ignoreFile = Path.Combine(this.initFolder,
                                Constants.GITIGNORE_FILENAME);
                            if (File.Exists(ignoreFile))
                            {
                                ignoreRules = File.ReadAllLines(ignoreFile)
                                                  .Where(line => !line.StartsWith("#") && line.Trim().Length > 0)
                                                  .Select(line => new IgnoreRule(line)).ToList();
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.WriteLine("ReadIgnoreFile: {0}\r\n{1}", this.initFolder, ex.ToString());
                        }
                    }
                }
                catch (Exception ex)
                {
                    this.repository = null;
                    Log.WriteLine("Refresh: {0}\r\n{1}", this.initFolder, ex.ToString());
                }
            }
        }
 public void Refresh()
 {
     this.cache.Clear();
     this.changedFiles = null;
     this.repositoryGraph = null;
     this.head = null;
     this.remotes = null;
     this.configs = null;
     if (!string.IsNullOrEmpty(initFolder))
     {
         try
         {
             this.repository = Open(new DirectoryInfo(initFolder));
             if (this.repository != null)
             {
                 head = repository.Resolve(Constants.HEAD);
                 if (repository.IsBare)
                     throw new NoWorkTreeException();
             }
         }
         catch (Exception ex)
         {
             this.repository = null;
             Log.WriteLine("Refresh: {0}\r\n{1}", this.initFolder, ex.ToString());
         }
     }
 }
        public void Refresh()
        {
            this.cache.Clear();
            this.changedFiles = null;
            this.repositoryGraph = null;

            if (!string.IsNullOrEmpty(initFolder))
            {
                try
                {
                    this.repository = Open(new DirectoryInfo(initFolder));
                }
                catch (Exception ex)
                {
                    Log.WriteLine("Refresh: {0}\r\n{1}", this.initFolder, ex.ToString());
                }
            }
        }
Beispiel #6
0
 public void Refresh()
 {
     this.repositoryGraph = null;
     this.changedFiles = null;
     this.branch = null;
     this.remotes = null;
     this.configs = null;
     this.ignored = null;
 }
        public void Refresh()
        {
            this.cache.Clear();
            this.changedFiles = null;
            this.repositoryGraph = null;

            if (!string.IsNullOrEmpty(initFolder))
            {
                try
                {
                    this.repository = Git.Open(initFolder).GetRepository();

                    if (this.repository != null)
                    {
                        var id = repository.Resolve(Constants.HEAD);
                        //var commit = repository.MapCommit(id);
                        //this.commitTree = (commit != null ? commit.TreeEntry : new Tree(repository));
                        if (id == null)
                        {
                            this.commitTree = new Tree(repository);
                        }
                        else
                        {
                            var treeId = ObjectId.FromString(repository.Open(id).GetBytes(), 5);
                            this.commitTree = new Tree(repository, treeId, repository.Open(treeId).GetBytes());
                        }
                        this.index = repository.GetIndex();
                        this.index.RereadIfNecessary();

                        ignoreRules = File.ReadAllLines(Path.Combine(this.initFolder, Constants.GITIGNORE_FILENAME))
                                          .Where(line => !line.StartsWith("#") && line.Trim().Length > 0)
                                          .Select(line => new IgnoreRule(line)).ToList();
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }