source

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package source contains functions that help with Gerrit source control specific logics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneURIFromOrgRepo

func CloneURIFromOrgRepo(org, repo string) string

CloneURIFromOrgRepo returns normalized cloneURI from org and repo. The returns cloneURI will always have https:// or http:// prefix, and there is no trailing slash at the end.

func CodeRootURL

func CodeRootURL(reviewURL string) (string, error)

CodeRootURL converts code review URL into source code URL, simply trimming the `-review` suffix from the name of the org.

Gerrit URL for sourcecode looks like https://android.googlesource.com, and the code review URL looks like https://android-review.googlesource.com/c/platform/frameworks/support/+/2260382.

func IsGerritOrg

func IsGerritOrg(org string) bool

IsGerritOrg tells whether the org is a Gerrit org or not. It returns true when the org string starts with https://.

func NormalizeCloneURI

func NormalizeCloneURI(cloneURI string) string

NormalizeCloneURI returns normalized cloneURI. It ensures that cloneURI always has https:// or http:// prefix, and there is no trailing slash at the end. This function should be used everywhere that Gerrit cloneURI is referenced.

func NormalizeOrg

func NormalizeOrg(org string) string

NormalizeOrg returns normalized org. It ensures that org always has https:// or http:// prefix, and there is no trailing slash at the end. This function should be used everywhere that Gerrit org is referenced.

func OrgRepoFromCloneURI

func OrgRepoFromCloneURI(cloneURI string) (string, string, error)

OrgRepoFromCloneURI returns org and repo from cloneURI. The returned org always has https:// or http:// prefix even if cloneURI doesn't have it.

func TrimHTTPSPrefix

func TrimHTTPSPrefix(in string) string

TrimHTTPSPrefix trims https:// and http:// from input, also remvoes all trailing slashes from the end.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL