diff --git a/README.md b/README.md index f8bf632..07b75eb 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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. @@ -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 @@ -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 \ No newline at end of file +![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. diff --git a/images/change-branch.gif b/images/change-branch.gif new file mode 100644 index 0000000..1b9960b Binary files /dev/null and b/images/change-branch.gif differ diff --git a/package.json b/package.json index 3ddc96c..2d5da90 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,7 @@ "icon": "icon.png", "enableProposedApi": false, "categories": [ - "Other", - "SCM" + "Other" ], "activationEvents": [ "*" @@ -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": [ @@ -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" }, @@ -671,9 +674,9 @@ "default": null, "isExecutable": true }, - "hg.autorefresh": { + "hg.autoRefresh": { "type": "boolean", - "description": "%config.autorefresh%", + "description": "%config.autoRefresh%", "default": true }, "hg.commandMode": { @@ -685,9 +688,9 @@ "server" ] }, - "hg.autoinout": { + "hg.autoInOut": { "type": "boolean", - "description": "%config.autoinout%", + "description": "%config.autoInOut%", "default": true }, "hg.countBadge": { @@ -703,7 +706,7 @@ "hg.allowPushNewBranches": { "type": "boolean", "description": "%config.allowPushNewBranches%", - "default": false + "default": true } } } diff --git a/package.nls.json b/package.nls.json index 83d5e5d..bfff7cc 100644 --- a/package.nls.json +++ b/package.nls.json @@ -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", diff --git a/src/autoinout.ts b/src/autoinout.ts index 349552b..0a17725 100644 --- a/src/autoinout.ts +++ b/src/autoinout.ts @@ -23,7 +23,7 @@ export class AutoIncomingOutgoing { private onConfiguration(): void { const hgConfig = workspace.getConfiguration('hg'); - if (hgConfig.get('autoinout') === false) { + if (hgConfig.get('autoInOut') === false) { this.disable(); } else { diff --git a/src/model.ts b/src/model.ts index a3c9c81..7977bcf 100644 --- a/src/model.ts +++ b/src/model.ts @@ -870,9 +870,9 @@ export class Model implements Disposable { private onFSChange(uri: Uri): void { const config = workspace.getConfiguration('hg'); - const autorefresh = config.get('autorefresh'); + const autoRefresh = config.get('autoRefresh'); - if (!autorefresh) { + if (!autoRefresh) { return; } diff --git a/src/scmProvider.ts b/src/scmProvider.ts index b8a540e..3c9bf58 100644 --- a/src/scmProvider.ts +++ b/src/scmProvider.ts @@ -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 { @@ -36,15 +38,25 @@ export class MercurialSCMProvider { } get count(): number { - const countBadge = workspace.getConfiguration('hg').get('countBadge'); + const countBadge = workspace.getConfiguration('hg').get('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 } }