Giter Site home page Giter Site logo

posh-hg's Introduction

posh-hg

This project is no longer under development and is not maintained. Please feel free to use the code, but no changes will be made and no pull requests will be merged in.

Inspired by the Posh-Git project (http://github.com/dahlbyk/posh-git), Posh-Hg provides a set of PowerShell scripts which provide Mercurial/PowerShell integration

Prompt for Hg repositories

The prompt within Hg repositories can show the current branch and the state of files (additions, modifications, deletions) within.

Tab completion

Provides tab completion for common commands when using hg.
E.g. hg up<tab> --> hg update

Usage

See profile.example.ps1 as to how you can integrate the tab completion and/or hg prompt into your own profile. Prompt formatting, among other things, can be customized using the $PoshHgSettings variable.

Installing

  1. Verify you have PowerShell 2.0 or better with $PSVersionTable.PSVersion

  2. Verify execution of scripts is allowed with Get-ExecutionPolicy (should be RemoteSigned or Unrestricted). If scripts are not enabled, run PowerShell as Administrator and call Set-ExecutionPolicy RemoteSigned -Confirm.

  3. Verify that hg can be run from PowerShell. If the command is not found, you will need to add a hg alias or add %ProgramFiles%\TortoiseHg to your PATH environment variable.

  4. Clone the posh-hg repository to your local machine.

  5. From the posh-hg repository directory, run .\install.ps1.

  6. Enjoy!

The Prompt

PowerShell generates its prompt by executing a prompt function, if one exists. posh-hg defines such a function in profile.example.ps1 that outputs the current working directory followed by an abbreviated hg status:

C:\Users\JSkinner [default]>

By default, the status summary has the following format:

[{HEAD-name} +A ~B -C ?D !E ^F <G:H>]
  • {HEAD-name} is the current branch, or the SHA of a detached HEAD
  • Cyan means the branch matches its remote
  • Red means the branch is behind its remote
  • ABCDEFGH represent the working directory
  • + = Added files
  • ~ = Modified files
  • - = Removed files
  • ? = Untracked files
  • ! = Missing files
  • ^ = Renamed files
  • <G:H> = Current revision information matching the output of hg log -r . --template '{rev}:{node|short}'

Additionally, Posh-Hg can show any tags and bookmarks in the prompt as well as MQ patches if the MQ extension is enabled (disabled by default)

Based on work by:

posh-hg's People

Contributors

bmsullivan avatar dahlbyk avatar dfjacobs avatar ekroon avatar eugeneduvenage avatar jbogard avatar jeremyskinner avatar jordanmorris avatar jpoehls avatar jrsconfitto avatar matthewrfindley avatar maxslimmer avatar nathanpalmer avatar petemill avatar rstuven avatar vcaraulean avatar woodyza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

posh-hg's Issues

Tab completion for revert/filename doesn't deal with working directory well

Let's say I have a hg repository in C:\Foo:

C:\> cd \Foo\Bar
C:\Foo\Bar [default ~1 tip]> hg status
M C:\Foo\Baz\file.txt

But I didn't want to change that file, so I'd like to revert. I type:

C:\Foo\Bar [default ~1 tip]> hg revert [tab]

Expected

C:\Foo\Bar [default ~1 tip]> hg revert ..\Baz\file.txt

or

C:\Foo\Bar [default ~1 tip]> hg revert C:\Foo\Baz\file.txt

Actual

C:\Foo\Bar [default ~1 tip]> hg revert Baz\file.txt

...which doesn't work.

Completion of bookmarks

It'd be really nice to have Tab completion of bookmark names on hg up and hg push -B. There may be other commands where this is useful, I just can't remember them at the moment.

posh-hg from nuget console (in visual studio)

I currently have problems getting posh-hg working in the visual studio package manager console. The only thing i see is C:\my\pathPM> where PM is not part of the path, however PM only shows when i'm inside a mercurial repository... Any ideas?

Use same codes as hg status

Posh-hg uses, e.g., + to mean added, whereas hg status uses A for added. Also, these values (+, ~, etc.) are hard-coded and can't be changed via $global.PoshHgSettings.

I'd suggest that:

  1. The status codes should be configurable, like the rest of the prompt, and
  2. The default should be the same as those values shown in hg status --help

I can implement this myself, but wanted to put the idea out for discussion first.

Prompt hangs intermittently

I continue to run into the same issue reported in this Superuser question which implicated posh-git.

When I run into the issue, it causes my Powershell to fail (hang indefinitely) after any command. The only way I've found to recover is to rename my Powershell profile (causing it to be disabled), start Powershell (maybe even as non-admin), and then restore my profile.

As I mention in the answer to the question, the issue appears to have been fixed for posh-git, likely in this commit.

I would be very interested in getting this fix applied to posh-hg as well. I'd gladly help incentivize a fix if I can. Just let me know you're interested and capable of solving the issue and I'll create a bountysource bounty.

tags with spaces are printed as if multiple tags

I've got an MQ patch called "refactoring for new design", and the commandline shows

[default ~3 qbase, qtip, refactoring, for, new, design mq: refactoring>

For one, obviously I'd like the tag to be printed as a single tag.

For two, since it's an applied MQ patch, it would be nice if it weren't listed as a tag at all.

Hg is very slow on mapped network drivers

Hello,

I'm using ConEmu + posh-hg. Thanks for the tool, its is really great.

The only serious issue I've found so far is regarding mapped network drivers.

I've use the command New-PSDrive –Name "Z" –PSProvider FileSystem –Root \\myremote\myshare –Persist to create a new network driver. It happens that the path is a mecurial repository. However, hg.exe takes a long time to resolve this path. It isn't a network issue because this share is actually on one of my virtual machines. When I disable hg, it is very fast to access the folder.

I can profile the directory change to see how long it takes, but it's about 5, 6 seconds everytime I hit the "enter" button. My machine is also OK (i7, 16 GB RAM, SSD), so it should not take that long.

Thanks for everything

Instructions or script for uninstall

I've had an experience where something went wrong with the installation of posh-hg, so I'd like to re-install it. The problem is that when running through the install script, it only says, "It seems posh-hg is already installed...". It would be great to have an uninstall script or uninstall instructions that would leave the system in a state where posh-hg could be installed again.

Posh-hg dies in terminal without color support

Notably, in Powershell ISE.

  1. In ISE, PS C:\Repo> Import-Module C:\Source\posh-hg\posh-hg.psm1
  2. PS C:\Repo> $global:PoshHgSettings and note the colors are -1
  3. PS C:\Repo> write-vcsstatus fails with 6 errors like the following:
    Write-Host : Cannot process Color because -1 is not a valid color.
    Parameter name: value
    Actual value was -1.
    At C:\Source\posh-hg\HgPrompt.ps1:16 char:19
    +         Write-Host <<<<  $s.BeforeText -NoNewline -BackgroundColor $s.BeforeBackgroundColor -ForegroundColor $s.BeforeForegroundColor
        + CategoryInfo          : InvalidArgument: (:) [Write-Host], ArgumentOutOfRangeException
        + FullyQualifiedErrorId : SetInvalidBackgroundColor,Microsoft.PowerShell.Commands.WriteHostCommand

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.