Skip to content

Commit

Permalink
Getting branch name from .hg/branch file which is super fast 😎🐎 The s…
Browse files Browse the repository at this point in the history
…ame way I've done with 'branch' oh-my-zsh plugin.
  • Loading branch information
victor-torres committed Mar 17, 2016
1 parent c0d6b96 commit 743a867
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 0 additions & 2 deletions lib/atom-hg.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
HgRepository = require './hg-repository'

# @pathToRepository = {}

module.exports =
activate: ->
console.log 'Activating atom-hg...'
Expand Down
2 changes: 1 addition & 1 deletion lib/hg-repository.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class HgRepository
# for, only needed if the repository contains submodules.
#
# Returns a {String}.
getShortHead: (path) -> @getRepo().getShortHead()
getShortHead: (path) -> @getRepo(path).getShortHead()

# Public: Is the given path a submodule in the repository?
#
Expand Down
5 changes: 2 additions & 3 deletions lib/hg-utils.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ class Repository
hasChanged = false
revision = @getHgWorkingCopyRevision()
if revision?
# remove modified, switched and partial infos from revision number
revision = revision.replace(/[MSP]/gi, '')
if revision != @revision
@revision = revision
hasChanged = true
Expand All @@ -95,7 +93,8 @@ class Repository
return hasChanged

getShortHead: () ->
return @shortHead
branchFile = @rootPath + '/.hg/branch'
return fs.readFileSync branchFile, 'utf8'

###
Section: TreeView Path Mercurial status
Expand Down

0 comments on commit 743a867

Please sign in to comment.