MCPcopy Index your code
hub / github.com/git-bug/git-bug / pull

Method pull

termui/bug_table.go:463–518  ·  view source on GitHub ↗
(g *gocui.Gui, v *gocui.View)

Source from the content-addressed store, hash-verified

461}
462
463func (bt *bugTable) pull(g *gocui.Gui, v *gocui.View) error {
464 ui.msgPopup.Activate("Pull from remote "+defaultRemote, "...")
465
466 go func() {
467 stdout, err := bt.repo.Fetch(defaultRemote)
468
469 if err != nil {
470 g.Update(func(gui *gocui.Gui) error {
471 ui.msgPopup.Activate(msgPopupErrorTitle, err.Error())
472 return nil
473 })
474 } else {
475 g.Update(func(gui *gocui.Gui) error {
476 ui.msgPopup.UpdateMessage(stdout)
477 return nil
478 })
479 }
480
481 var buffer bytes.Buffer
482 beginLine := ""
483
484 for result := range bt.repo.MergeAll(defaultRemote) {
485 if result.Status == entity.MergeStatusNothing {
486 continue
487 }
488
489 if result.Err != nil {
490 g.Update(func(gui *gocui.Gui) error {
491 ui.msgPopup.Activate(msgPopupErrorTitle, err.Error())
492 return nil
493 })
494 } else {
495 _, _ = fmt.Fprintf(&buffer, "%s%s: %s",
496 beginLine, colors.Cyan(result.Entity.Id().Human()), result,
497 )
498
499 beginLine = "\n"
500
501 g.Update(func(gui *gocui.Gui) error {
502 ui.msgPopup.UpdateMessage(buffer.String())
503 return nil
504 })
505 }
506 }
507
508 _, _ = fmt.Fprintf(&buffer, "%sdone", beginLine)
509
510 g.Update(func(gui *gocui.Gui) error {
511 ui.msgPopup.UpdateMessage(buffer.String())
512 return nil
513 })
514
515 }()
516
517 return nil
518}
519
520func (bt *bugTable) push(g *gocui.Gui, v *gocui.View) error {

Callers

nothing calls this directly

Calls 8

FetchMethod · 0.80
UpdateMessageMethod · 0.80
MergeAllMethod · 0.65
IdMethod · 0.65
StringMethod · 0.65
ActivateMethod · 0.45
ErrorMethod · 0.45
HumanMethod · 0.45

Tested by

no test coverage detected