Example #1
0
        public void OnClientNotify(object sender, GitNotifyEventArgs e)
        {
            string path = e.FullPath;
            GitNotifyAction action = e.Action;
            string rev = e.Revision;

            Enqueue(delegate()
            {
                ListViewItem item = null;
                item = new ListViewItem(GetActionText(action));

                switch (action)
                {
                    case GitNotifyAction.BlameRevision:
                        {
                            string file = Path.GetFileName(path);

                            item.SubItems.Add(string.Format("{0} - r{1}", file, rev));
                            break;
                        }
                    default:
                        if (!string.IsNullOrEmpty(path))
                        {
                            string sr = SplitRoot;
                            if (!string.IsNullOrEmpty(sr))
                            {
                                if (path.StartsWith(sr, StringComparison.OrdinalIgnoreCase))
                                    path = path.Substring(sr.Length).Replace(Path.DirectorySeparatorChar, '/');
                            }

                            item.SubItems.Add(path);
                        }
                        break;
                }

                if (item != null)
                    _toAdd.Add(item);
            });
        }
            protected override void OnNotify(GitNotifyEventArgs e)
            {
                base.OnNotify(e);

                string path = e.FullPath;

                if (string.IsNullOrEmpty(path))
                    return;

                GitClientAction action;
                if (!_changes.TryGetValue(path, out action))
                    _changes.Add(path, action = new GitClientAction(path));

                switch (e.Action)
                {
                    case GitNotifyAction.CommitDeleted:
                    case GitNotifyAction.Revert:
                    case GitNotifyAction.TreeConflict:
                        action.Recursive = true;
                        break;
                    case GitNotifyAction.UpdateDelete:
                        action.Recursive = true;
                        action.AddOrRemove = true;
                        break;
                    case GitNotifyAction.UpdateReplace:
                    case GitNotifyAction.UpdateAdd:
                        action.AddOrRemove = true;
                        break;
                    case GitNotifyAction.UpdateUpdate:
                        // action.OldRevision = e.OldRevision;
                        break;
                }
            }
Example #3
0
 public void RaiseNotify(GitNotifyEventArgs e)
 {
     Args.OnNotify(e);
     Client.OnNotify(e);
 }
Example #4
0
        protected internal virtual void OnNotify(GitNotifyEventArgs e)
        {
            var ev = Notify;

            if (ev != null)
                Notify(this, e);
        }