Pull allows references to be pulled from a remote.
()
| 9 | |
| 10 | // Pull allows references to be pulled from a remote. |
| 11 | func (s SpreadCli) Pull() *cli.Command { |
| 12 | return &cli.Command{ |
| 13 | Name: "pull", |
| 14 | Usage: "Pull changes from a remote branch", |
| 15 | ArgsUsage: "<remote> <branch>", |
| 16 | Description: "Pull Spread data from a remote branch", |
| 17 | Action: func(c *cli.Context) { |
| 18 | remoteName := c.Args().First() |
| 19 | if len(remoteName) == 0 { |
| 20 | s.fatalf("a remote must be specified") |
| 21 | } |
| 22 | |
| 23 | if len(c.Args()) < 2 { |
| 24 | s.fatalf("a refspec must be specified") |
| 25 | } |
| 26 | |
| 27 | refspec := c.Args().Get(1) |
| 28 | if !strings.HasPrefix(refspec, "refs/") { |
| 29 | refspec = fmt.Sprintf("refs/heads/%s", refspec) |
| 30 | } |
| 31 | |
| 32 | p := s.projectOrDie() |
| 33 | if err := p.Pull(remoteName, refspec); err != nil { |
| 34 | s.fatalf("Failed to pull: %v", err) |
| 35 | } |
| 36 | }, |
| 37 | } |
| 38 | } |
nothing calls this directly
no test coverage detected