Example #1
0
        public void draw(Console console, int i)
        {
            scroll = GUILayout.BeginScrollView(scroll);

            GUI.enabled = !isPushing;

            if (isPushing)
            {
                doesRequireFetch = true;
            }
            else if (!isPushing && doesRequireFetch)
            {
                //# Trigger a fetch
                doesRequireFetch = false;
                console.fetch();
            }

            foreach (Commit commit in console.repo.Commits.QueryBy(new Filter {
                Since = console.branch.Tip, Until = console.branch.TrackedBranch
            }))
            {
                console.getUpdateItem(commit, commit.Parents.First(), rect, onCommitSelected);
            }

            GUI.enabled = true;

            GUILayout.EndScrollView();
        }
		public void draw( Console console, int i ) {
			scroll = GUILayout.BeginScrollView( scroll );

			GUI.enabled = !isPushing;

			if ( isPushing ) {
				doesRequireFetch = true;
			} else if ( !isPushing && doesRequireFetch ) {
				//# Trigger a fetch
				doesRequireFetch = false;
				console.fetch();
			}

			foreach ( Commit commit in console.repo.Commits.QueryBy( new Filter {
				Since = console.branch.Tip, Until = console.branch.TrackedBranch
			} ) ) {
				console.getUpdateItem( commit, commit.Parents.First(), rect, onCommitSelected );
			}

			GUI.enabled = true;

			GUILayout.EndScrollView();
		}
        public void draw(Console console, int i)
        {
            scroll = GUILayout.BeginScrollView(scroll);

            try {
                pathNodes.Clear();
                treeView.nodes.Clear();

                changes = changes ?? console.repo.Diff.Compare();

                foreach (TreeEntryChanges change in changes)
                {
                    buildTreeView(change);
                }

                foreach (string untrackedFile in untracked)
                {
                    buildTreeView(untrackedFile);
                }

                drawTreeView(console);
            }
            catch {}

            GUILayout.EndScrollView();

            GUILayout.Label("Commit message:");
            commitText = GUILayout.TextArea(commitText);
            if (GUILayout.Button("Commit Changes"))
            {
                Signature signature = new Signature("Jerome Doby", "*****@*****.**", System.DateTimeOffset.Now);

                //# Stage everything
                string[] stage = new string[checkboxValues.Count];

                i = 0;
                foreach (KeyValuePair <string, bool> pair in checkboxValues)
                {
                    if (pair.Value)
                    {
                        stage[i] = pair.Key;
                        i++;
                    }
                }

                stage = stage.Where(x => !string.IsNullOrEmpty(x)).ToArray();

                if (stage.Length == 0)
                {
                    console.currentError         = "You cannot commit without staged items.";
                    console.currentErrorLocation = rect;
                }
                else if (commitText.Equals(string.Empty))
                {
                    console.currentError         = "Please enter a commit message.";
                    console.currentErrorLocation = rect;
                }
                else
                {
                    console.repo.Index.Stage(stage);
                    console.repo.Commit(commitText, signature);

                    checkboxValues.Clear();
                    foldoutValues.Clear();

                    console.fetch();
                }

                commitText = string.Empty;
            }
        }
		public void draw( Console console, int i ) {

			scroll = GUILayout.BeginScrollView( scroll );

			try {
				pathNodes.Clear();
				treeView.nodes.Clear();

				changes = changes ?? console.repo.Diff.Compare();

				foreach ( TreeEntryChanges change in changes ) {
					buildTreeView( change );
				}

				foreach ( string untrackedFile in untracked ) {
					buildTreeView( untrackedFile );
				}

				drawTreeView( console );
			}
			catch {}

			GUILayout.EndScrollView();

			GUILayout.Label( "Commit message:" );
			commitText = GUILayout.TextArea( commitText );
			if ( GUILayout.Button( "Commit Changes" ) ) {
				Signature signature = new Signature( "Jerome Doby", "*****@*****.**", System.DateTimeOffset.Now );

				//# Stage everything
				string[] stage = new string[ checkboxValues.Count ];

				i = 0;
				foreach ( KeyValuePair<string, bool> pair in checkboxValues ) {
					if ( pair.Value ) {
						stage[ i ] = pair.Key;
						i++;
					}
				}

				stage = stage.Where( x => !string.IsNullOrEmpty( x ) ).ToArray();

				if ( stage.Length == 0 ) {
					console.currentError = "You cannot commit without staged items.";
					console.currentErrorLocation = rect;
				} else if ( commitText.Equals( string.Empty ) ) {
					console.currentError = "Please enter a commit message.";
					console.currentErrorLocation = rect;
				} else {
					console.repo.Index.Stage( stage );
					console.repo.Commit( commitText, signature );

					checkboxValues.Clear();
					foldoutValues.Clear();

					console.fetch();
				}

				commitText = string.Empty;
			}
		}