本文整理匯總了Golang中github.com/github/git-lfs/lfs.TransferQueue.Process方法的典型用法代碼示例。如果您正苦於以下問題:Golang TransferQueue.Process方法的具體用法?Golang TransferQueue.Process怎麽用?Golang TransferQueue.Process使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/github/git-lfs/lfs.TransferQueue
的用法示例。
在下文中一共展示了TransferQueue.Process方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: pushCommand
// pushCommand pushes local objects to a Git LFS server. It takes two
// arguments:
//
// `<remote> <remote ref>`
//
// Both a remote name ("origin") or a remote URL are accepted.
//
// pushCommand calculates the git objects to send by looking comparing the range
// of commits between the local and remote git servers.
func pushCommand(cmd *cobra.Command, args []string) {
var left, right string
var uploadQueue *lfs.TransferQueue
if len(args) == 0 {
Print("Specify a remote and a remote branch name (`git lfs push origin master`)")
os.Exit(1)
}
lfs.Config.CurrentRemote = args[0]
if useStdin {
requireStdin("Run this command from the Git pre-push hook, or leave the --stdin flag off.")
// called from a pre-push hook! Update the existing pre-push hook if it's
// one that git-lfs set.
lfs.InstallHooks(false)
refsData, err := ioutil.ReadAll(os.Stdin)
if err != nil {
Panic(err, "Error reading refs on stdin")
}
if len(refsData) == 0 {
return
}
left, right = decodeRefs(string(refsData))
if left == pushDeleteBranch {
return
}
uploadQueue = uploadsBetweenRefs(left, right)
} else if pushObjectIDs {
if len(args) < 2 {
Print("Usage: git lfs push --object-id <remote> <lfs-object-id> [lfs-object-id] ...")
return
}
uploadQueue = uploadsWithObjectIDs(args[1:])
} else {
var remoteArg, refArg string
if len(args) < 1 {
Print("Usage: git lfs push --dry-run <remote> [ref]")
return
}
remoteArg = args[0]
if len(args) == 2 {
refArg = args[1]
}
localRef, err := git.CurrentRef()
if err != nil {
Panic(err, "Error getting local ref")
}
left = localRef
remoteRef, err := git.LsRemote(remoteArg, refArg)
if err != nil {
Panic(err, "Error getting remote ref")
}
if remoteRef != "" {
right = "^" + strings.Split(remoteRef, "\t")[0]
}
uploadQueue = uploadsBetweenRefs(left, right)
}
if !pushDryRun {
uploadQueue.Process()
for _, err := range uploadQueue.Errors() {
if Debugging || err.Panic {
LoggedError(err.Err, err.Error())
} else {
Error(err.Error())
}
}
if len(uploadQueue.Errors()) > 0 {
os.Exit(2)
}
}
}