Update push

This commit is contained in:
rubyist 2015-01-30 14:23:41 -05:00
parent 82df4a7942
commit 9e81fd38c9

@ -15,7 +15,7 @@ import (
var ( var (
pushCmd = &cobra.Command{ pushCmd = &cobra.Command{
Use: "push", Use: "push",
Short: "Push files to the media endpoint", Short: "Push files to the hawser endpoint",
Run: pushCommand, Run: pushCommand,
} }
dryRun = false dryRun = false
@ -23,7 +23,7 @@ var (
deleteBranch = "(delete)" deleteBranch = "(delete)"
) )
// pushCommand is the command that's run via `git media push`. It has two modes // pushCommand is the command that's run via `git hawser push`. It has two modes
// of operation. The primary mode is run via the git pre-push hook. The pre-push // of operation. The primary mode is run via the git pre-push hook. The pre-push
// hook passes two arguments on the command line: // hook passes two arguments on the command line:
// 1. Name of the remote to which the push is being done // 1. Name of the remote to which the push is being done
@ -36,18 +36,18 @@ var (
// by using the following: // by using the following:
// git rev-list --objects <local sha1> ^<remote sha1> // git rev-list --objects <local sha1> ^<remote sha1>
// //
// If any of those git objects are associated with git media objects, those git // If any of those git objects are associated with hawser objects, those hawser
// media objects will be pushed to the git media endpoint. // objects will be pushed to the hawser endpoint.
// //
// In the case of pushing a new branch, the list of git objects will be all of // In the case of pushing a new branch, the list of git objects will be all of
// the git objects in this branch. // the git objects in this branch.
// //
// In the case of deleting a branch, no attempts to push git media objects will be // In the case of deleting a branch, no attempts to push hawser objects will be
// made. // made.
// //
// When pushing git media objects, the client will first perform an OPTIONS command // When pushing hawser objects, the client will first perform an OPTIONS command
// which will determine not only whether or not the client is authorized, but also // which will determine not only whether or not the client is authorized, but also
// whether or not that git media endpoint already has the git media object. If it // whether or not that hawser endpoint already has the hawser object. If it
// does, the object will not be pushed. // does, the object will not be pushed.
// //
// The other mode of operation is the dry run mode. In this mode, the repo // The other mode of operation is the dry run mode. In this mode, the repo
@ -58,7 +58,7 @@ func pushCommand(cmd *cobra.Command, args []string) {
var left, right string var left, right string
if len(args) == 0 { if len(args) == 0 {
Print("The git media pre-push hook is out of date. Please run `git media update`") Print("The git hawser pre-push hook is out of date. Please run `git hawser update`")
os.Exit(1) os.Exit(1)
} }
@ -80,7 +80,7 @@ func pushCommand(cmd *cobra.Command, args []string) {
var repo, refspec string var repo, refspec string
if len(args) < 1 { if len(args) < 1 {
Print("Usage: git media push --dry-run <repo> [refspec]") Print("Usage: git hawser push --dry-run <repo> [refspec]")
return return
} }
@ -108,7 +108,7 @@ func pushCommand(cmd *cobra.Command, args []string) {
// Just use scanner here // Just use scanner here
pointers, err := scanner.Scan(left, right) pointers, err := scanner.Scan(left, right)
if err != nil { if err != nil {
Panic(err, "Error scanning for media files") Panic(err, "Error scanning for hawser files")
} }
for i, pointer := range pointers { for i, pointer := range pointers {
@ -122,9 +122,9 @@ func pushCommand(cmd *cobra.Command, args []string) {
} }
} }
// pushAsset pushes the asset with the given oid to the git media endpoint. It will // pushAsset pushes the asset with the given oid to the hawser endpoint. It will
// first make an OPTIONS call. If OPTIONS returns a 200 status, it indicates that the // first make an OPTIONS call. If OPTIONS returns a 200 status, it indicates that the
// git media endpoint already has a git media object for that oid. The object will // hawser endpoint already has a hawser object for that oid. The object will
// not be pushed again. // not be pushed again.
func pushAsset(oid, filename string, index, totalFiles int) *hawser.WrappedError { func pushAsset(oid, filename string, index, totalFiles int) *hawser.WrappedError {
tracerx.Printf("checking_asset: %s %s %d/%d", oid, filename, index, totalFiles) tracerx.Printf("checking_asset: %s %s %d/%d", oid, filename, index, totalFiles)