Skip to content

Commit a9892a3

Browse files
authored
Merge pull request #850 from cambot/docs/update_menu_behavior
Update documentation for menu item behaviors in "Basic" Mode
2 parents 0ee1cd6 + ede203b commit a9892a3

File tree

2 files changed

+45
-14
lines changed

2 files changed

+45
-14
lines changed

cls/SourceControl/Git/Utils.cls

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ ClassMethod Commit(InternalName As %String, Message As %String = "example commit
414414
quit $$$OK
415415
}
416416

417+
/// <p>This function performs <code>git checkout -b [newBranchName]</code> from the current commit.</p>
418+
/// <p>If the user is in "Basic Mode" AND there is a Default Merge Branch defined,
419+
/// then this method first checks out and pulls that default merge branch before creating the new branch. This is
420+
/// equivalent to <code>git checkout [defaultMergeBranch] && git pull</code>.</p>
417421
ClassMethod NewBranch(newBranchName As %String) As %Status
418422
{
419423
set settings = ##class(SourceControl.Git.Settings).%New()
@@ -511,8 +515,12 @@ ClassMethod StageAddedFiles()
511515
}
512516
}
513517

514-
/// Merges the files from the configured branch as part of the Sync operation
515-
/// Returns true if this resulted in durable changes to the local git repo
518+
/// <p>If there is a configured "Default Merge Branch", then
519+
/// <ol>
520+
/// <li>fetch the current version of the default merge branch.</li>
521+
/// <li>attempt to rebase the current branch onto the default merge branch.</li>
522+
/// </ol>
523+
/// Returns true if this resulted in durable changes to the local git repo, false otherwise.</p>
516524
ClassMethod MergeDefaultRemoteBranch(Output alert As %String = "") As %Boolean
517525
{
518526
set rebased = 0

docs/menu-items.md

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Status
44
This menu option is analogous to the [git status](https://git-scm.com/docs/git-status) command and prints the status of the repository to the output.
55

6+
67
## Settings
78
This option opens the GUI's settings page project specific git-source-control settings can be configured. This includes the settings that were configured when running:
89
```
@@ -13,48 +14,70 @@ This page also includes the mappings configurations.
1314

1415
Any changes made to the settings must be saved using the 'Save' button in order to take effect.
1516

17+
1618
## Launch Git UI
1719
This menu option opens the git-source-control GUI. From here commit messages can be written, files can be staged and committed, branches can be viewed.
1820

21+
1922
## Add
2023
This menu option is analogous to the [git add](https://git-scm.com/docs/git-add) command. It will perform 'git add' on the currently open file, adding it to the files that can be staged.
2124

25+
2226
## Remove
2327
This menu option will only appear if the currently open file has been already added using the 'Add' menu option. It undoes the effect of adding the file, similar to running [git reset](https://git-scm.com/docs/git-reset) on a specific file.
2428

25-
## Push to remote branch
29+
30+
## Push to Remote Branch
2631
This option pushes the commits in the branch to the remote repository. This exhibits the same behavior as the [git push](https://git-scm.com/docs/git-push) command.
2732

28-
## Push to remote branch (force)
33+
34+
## Push to Remote Branch (force)
2935
This option forcibly pushes the commits in the branch to the remote repository. This is potentially destructive and may overwrite the commit history of the remote branch. This exhibits the same behavior as the [git push --force](https://git-scm.com/docs/git-push) command.
3036

31-
## Fetch from remote
37+
38+
## Fetch from Remote
3239
This option first [fetches](https://git-scm.com/docs/git-fetch) the most recent version of the branch without merging that version into the local copy of the branch. It will then list all files modified between the current version and the remote version.
3340

3441
This also has the effect of refreshing the list of all remote branches and pruning any references that no longer exist in the remote. (see: [git fetch --prune](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---prune))
3542

36-
## Pull changes from remote branch
43+
44+
## Pull Changes from Remote Branch
3745
Much like the [git pull](https://git-scm.com/docs/git-pull) command, this menu option pulls the most recent version of the current branch from a remote source, merging the changes into the local copy.
3846

47+
3948
## Sync
40-
This option will synchronize a local repo with the remote repo. The sync operation is only enabled in basic mode. It encapsulates the pattern of fetching, pulling, committing and then pushing into one menu action. If there is no defined remote repository, it will simply commit any uncommitted files.
49+
This option will synchronize the current branch checked out a local repo with the same branch in a remote repo. It encapsulates the pattern of fetching, pulling, committing, and pushing into one menu action.
50+
- If you are on the Default Merge Branch, then Sync only pulls the latest commits from the remote. Committing is disallowed on the Default Merge Branch.
51+
- If there is no defined remote repository, it will simply commit all staged files.
52+
- If there is a Default Merge Branch defined, then sync attempts to perform a [rebase](https://git-scm.com/docs/git-rebase) onto the latest Default Merge Branch from the remote.
53+
- If the rebase were to result in merge conflicts, then this action is aborted so the system is not left in an inconsistent state.
4154

42-
## Create new branch
55+
The sync operation is only enabled in basic mode.
56+
57+
58+
## Create New Branch
4359
This menu option creates a new branch in the repository for changes to be committed to. It also changes the current branch to be the created branch. This mimics the behavior of the [git checkout -b](https://git-scm.com/docs/git-checkout) command.
4460

45-
## Check out an existing branch
46-
This option refreshes the local list of branches available in the upstream repository, and then changes the currently checkedout branch to the provided branch. This mimics the behavior of the [git fetch --prune](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---prune) and [git checkout](https://git-scm.com/docs/git-checkout) commands.
61+
In basic mode, this option first checks out the Default Merge Branch (if defined) and pulls that branch from the remote before creating the new branch.
62+
63+
64+
## Check Out an Existing Branch
65+
This option refreshes the local list of branches available in the upstream repository, and then changes the currently checked out branch to the provided branch. This mimics the behavior of the [git fetch --prune](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---prune) and [git checkout](https://git-scm.com/docs/git-checkout) commands.
4766

4867
If the desired branch does not exist in your local or in the remote, then you will receive the "Selected branch does not exist" error message.
4968

50-
## Export all
69+
70+
## Export All
5171
This option exports class files to the local file tree at the configured location.
5272

53-
## Export all (force)
73+
74+
## Export All (Force)
5475
This option exports all class files regardless of whether they're already up to date in the local file tree or not.
5576

56-
## Import all
77+
78+
## Import All
5779
This option imports the versions of the files that are found in the configured directory into the project. Files that are out of date or the same as the files in the project won't be imported.
5880

59-
## Import all (force)
81+
82+
## Import All (Force)
6083
This menu option behaves similarly to the regular import but forces the files to be imported regardless of whether the on-disk version is the same or older.

0 commit comments

Comments
 (0)