Skip to content

Commit

Permalink
Consistent config casing + documentation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Crowl committed Apr 21, 2017
1 parent fb6beae commit 824e0d2
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 32 deletions.
62 changes: 51 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Fast, integrated Mercurial source control, using the new VS Code SCM API.

> **Note**: This extension will leverage your
> **Note**: This extension leverages your
> machine's Mercurial (hg) installation,
> so you need to [install Mercurial](https://www.mercurial-scm.org) first.
Expand All @@ -14,7 +14,7 @@ Fast, integrated Mercurial source control, using the new VS Code SCM API.

* See changes inline within text editor.

* History (log) and diff.
* Interactive log for basic file history and diff.

* Branch, merge heads, merge with branch, resolve + unresolve files.

Expand All @@ -24,10 +24,6 @@ Fast, integrated Mercurial source control, using the new VS Code SCM API.

* Undo/rollback

* Two command modes:
* `cli`: spawns a new hg process per command
* `server`: keeps an `hg serve --cmdserve` process running (default, 10x faster)

# Getting Started

## Switch to Hg
Expand All @@ -42,8 +38,52 @@ Fast, integrated Mercurial source control, using the new VS Code SCM API.

## Initialize a new repo

![Switch to Hg](images/init.gif)

* Just click the Mercurial icon from the source control title area:

## Clone a repo
![Init a repo](images/init.gif)

* Just click the Mercurial icon from the source control title area:

## Update to a branch/tag

![Change branches](images/change-branch.gif)

* The current branch name is shown in the bottom-left corner.
* Click it to see a list of branches and tags that you can update to.

## Settings

`hg.enabled { boolean }`
* Enables Hg as a source control manager in VS Code.

`hg.path { string | null }`
* Specifies an explicit `hg` file path to use.
* This should only be used if `hg` cannot be found automatically.
* The default behaviour is to search for `hg` in commonly-known install locations and on the PATH.

`hg.autoInOut { boolean }`
* Enables automatic counting of incoming/outgoing changes.
* When enabled, these show in the status bar.
* Updated every 3 minutes, or whenever a commit/push/pull is done.

`hg.autoRefresh { boolean }`

* Enables automatic refreshing of Source Control tab and badge counter when files within the project change:
`"true"` — enabled
`"false"` — disabled, manual refresh still available.

`hg.countBadge { tracked | all | off }`
* Controls the badge counter for Source Control in the activity bar:
`"tracked"` — only count changes to tracked files (default).
`"all"` — include untracked files in count.
`"off"` — no badge counter.

`hg.allowPushNewBranches { boolean }`
* Overrides the warning that normally occurs when a new branch is pushed:
`"true"` — new branches are pushed without warning (default).
`"false"` — shows a prompt when new branches are being pushed (e.g `hg push --new-branch`)

`hg.commandMode`
* Controls the method used to communicate with `hg`.
* Normally, there is a noticeable start-up performance cost with repeatedly running `hg` commands.
* By running a [command server](https://www.mercurial-scm.org/wiki/CommandServer) process in the background, frequently-used commands run ~10× faster (e.g. `cat`, `status`, `summary`, `branch` etc.)
`"server"` — run a command server process (default)  _i.e. `hg serve --cmdserve`_
`"cli"` — spawn a new `hg` process per command.
Binary file added images/change-branch.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"icon": "icon.png",
"enableProposedApi": false,
"categories": [
"Other",
"SCM"
"Other"
],
"activationEvents": [
"*"
Expand Down Expand Up @@ -414,6 +413,10 @@
{
"command": "hg.logDefault",
"when": "config.hg.enabled && scmProvider == hg && hgState == idle"
},
{
"command": "hg.logRepo",
"when": "config.hg.enabled && scmProvider == hg && hgState == idle"
}
],
"scm/title": [
Expand Down Expand Up @@ -478,7 +481,7 @@
"when": "config.hg.enabled && scmProvider == hg && hgState == idle"
},
{
"command": "hg.mergeWithLocal",
"command": "hg.mergeautothLocal",
"group": "5_merge",
"when": "config.hg.enabled && scmProvider == hg && hgState == idle"
},
Expand Down Expand Up @@ -671,9 +674,9 @@
"default": null,
"isExecutable": true
},
"hg.autorefresh": {
"hg.autoRefresh": {
"type": "boolean",
"description": "%config.autorefresh%",
"description": "%config.autoRefresh%",
"default": true
},
"hg.commandMode": {
Expand All @@ -685,9 +688,9 @@
"server"
]
},
"hg.autoinout": {
"hg.autoInOut": {
"type": "boolean",
"description": "%config.autoinout%",
"description": "%config.autoInOut%",
"default": true
},
"hg.countBadge": {
Expand All @@ -703,7 +706,7 @@
"hg.allowPushNewBranches": {
"type": "boolean",
"description": "%config.allowPushNewBranches%",
"default": false
"default": true
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"command.logDefault": "Log – default branch",
"command.logBranch": "Log – current branch",
"command.logRepo": "Log – entire repository",
"config.enabled": "Whether mercurial is enabled",
"config.path": "Path to the mercurial executable",
"config.autorefresh": "Whether auto refreshing is enabled",
"config.autoinout": "Whether auto-incoming/-outgoing counts are enabled",
"config.commandMode": "Change between using command-line and server* (hg serve --cmdserve) *experimental",
"config.enabled": "Whether Hg is enabled",
"config.path": "Path to the 'hg' executable (only required if auto-detection fails)",
"config.autoRefresh": "Whether auto refreshing is enabled",
"config.autoInOut": "Whether auto-incoming/outgoing counts are enabled",
"config.commandMode": "Change between using server and cli modes",
"config.enableLongCommitWarning": "Whether long commit messages should be warned about",
"config.countBadge": "Controls the mercurial badge counter",
"config.countBadge": "Controls the badge counter for Hg",
"config.checkoutType": "Controls what type of branches are listed",
"config.allowPushNewBranches": "Whether new branches are pushed without warning",
"command.mergeHeads": "Merge heads",
Expand Down
2 changes: 1 addition & 1 deletion src/autoinout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class AutoIncomingOutgoing {
private onConfiguration(): void {
const hgConfig = workspace.getConfiguration('hg');

if (hgConfig.get<boolean>('autoinout') === false) {
if (hgConfig.get<boolean>('autoInOut') === false) {
this.disable();
}
else {
Expand Down
4 changes: 2 additions & 2 deletions src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,9 +870,9 @@ export class Model implements Disposable {

private onFSChange(uri: Uri): void {
const config = workspace.getConfiguration('hg');
const autorefresh = config.get<boolean>('autorefresh');
const autoRefresh = config.get<boolean>('autoRefresh');

if (!autorefresh) {
if (!autoRefresh) {
return;
}

Expand Down
20 changes: 16 additions & 4 deletions src/scmProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { CommandCenter } from './commands';
import { mapEvent } from './util';
import * as nls from 'vscode-nls';

type BadgeOptions = 'off' | 'all' | 'tracked';

const localize = nls.loadMessageBundle();

export class MercurialSCMProvider {
Expand All @@ -36,15 +38,25 @@ export class MercurialSCMProvider {
}

get count(): number {
const countBadge = workspace.getConfiguration('hg').get<string>('countBadge');
const countBadge = workspace.getConfiguration('hg').get<BadgeOptions>('countBadge');

switch (countBadge) {
case 'off': return 0;
case 'tracked': return this.model.workingDirectoryGroup.resources.length;
case 'off':
return 0;

case 'tracked':
return this.model.mergeGroup.resources.length
+ this.model.stagingGroup.resources.length
+ this.model.workingDirectoryGroup.resources.length
+ this.model.conflictGroup.resources.length;

case 'all':
default:
return this.model.mergeGroup.resources.length
+ this.model.stagingGroup.resources.length
+ this.model.workingDirectoryGroup.resources.length;
+ this.model.workingDirectoryGroup.resources.length
+ this.model.conflictGroup.resources.length
+ this.model.untrackedGroup.resources.length
}
}

Expand Down

0 comments on commit 824e0d2

Please sign in to comment.