mirror of
https://github.com/atom/atom.git
synced 2026-01-24 22:38:20 -05:00
Conditionally include deprecations in GitRepository
This commit is contained in:
@@ -5,7 +5,7 @@ EmitterMixin = require('emissary').Emitter
|
||||
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
|
||||
fs = require 'fs-plus'
|
||||
GitUtils = require 'git-utils'
|
||||
{deprecate} = require 'grim'
|
||||
{includeDeprecations, deprecate} = require 'grim'
|
||||
|
||||
Task = require './task'
|
||||
|
||||
@@ -155,16 +155,6 @@ class GitRepository
|
||||
onDidChangeStatuses: (callback) ->
|
||||
@emitter.on 'did-change-statuses', callback
|
||||
|
||||
on: (eventName) ->
|
||||
switch eventName
|
||||
when 'status-changed'
|
||||
deprecate 'Use GitRepository::onDidChangeStatus instead'
|
||||
when 'statuses-changed'
|
||||
deprecate 'Use GitRepository::onDidChangeStatuses instead'
|
||||
else
|
||||
deprecate 'GitRepository::on is deprecated. Use event subscription methods instead.'
|
||||
EmitterMixin::on.apply(this, arguments)
|
||||
|
||||
###
|
||||
Section: Repository Details
|
||||
###
|
||||
@@ -252,9 +242,6 @@ class GitRepository
|
||||
# * `path` (optional) {String} path in the repository to get this information
|
||||
# for, only needed if the repository has submodules.
|
||||
getOriginURL: (path) -> @getConfigValue('remote.origin.url', path)
|
||||
getOriginUrl: (path) ->
|
||||
deprecate 'Use ::getOriginURL instead.'
|
||||
@getOriginURL(path)
|
||||
|
||||
# Public: Returns the upstream branch for the current HEAD, or null if there
|
||||
# is no upstream branch for the current HEAD.
|
||||
@@ -492,3 +479,18 @@ class GitRepository
|
||||
unless statusesUnchanged
|
||||
@emit 'statuses-changed'
|
||||
@emitter.emit 'did-change-statuses'
|
||||
|
||||
if includeDeprecations
|
||||
GitRepository::on = (eventName) ->
|
||||
switch eventName
|
||||
when 'status-changed'
|
||||
deprecate 'Use GitRepository::onDidChangeStatus instead'
|
||||
when 'statuses-changed'
|
||||
deprecate 'Use GitRepository::onDidChangeStatuses instead'
|
||||
else
|
||||
deprecate 'GitRepository::on is deprecated. Use event subscription methods instead.'
|
||||
EmitterMixin::on.apply(this, arguments)
|
||||
|
||||
GitRepository::getOriginUrl = (path) ->
|
||||
deprecate 'Use ::getOriginURL instead.'
|
||||
@getOriginURL(path)
|
||||
|
||||
Reference in New Issue
Block a user