Ejemplo n.º 1
0
// This will try and commit the $(bug pwd) directory
// transparently. It does the following steps:
//
// 1. "git stash create"
// 2. "git reset --mixed" (unstage the user's currently staged files)
// 3. "git add $(bug pwd)"
// 4. "git commit"
// 5a. "git reset --hard" (if there was any stash created,
// 						this is necessary for 5b to work.)
// 5b. "git stash apply --index" the stash from step 1
func (a BugApplication) Commit() {
	scm, _, err := scm.DetectSCM()
	if err != nil {
		fmt.Printf("Error: %s\n", err.Error())
		return
	}

	err = scm.Commit(bugs.GetIssuesDir(), "Added or removed issues with the tool \"bug\"")

	if err != nil {
		fmt.Printf("Could not commit: %s\n", err.Error())
		return
	}
}
Ejemplo n.º 2
0
func (a BugApplication) Purge() {
	scm, _, err := scm.DetectSCM()

	if err != nil {
		fmt.Printf("Error: %s\n", err.Error())
		return
	}

	err = scm.Purge(bugs.GetIssuesDir())
	if err != nil {
		fmt.Printf("Error: %s\n", err.Error())
		return
	}
}
Ejemplo n.º 3
0
func (a BugApplication) Env() {
	scm, scmdir, scmerr := scm.DetectSCM()
	fmt.Printf("Settings used by this command:\n")
	fmt.Printf("\nEditor: %s", getEditor())
	fmt.Printf("\nIssues directory: %s", bugs.GetIssuesDir())

	if scmerr == nil {
		fmt.Printf("\n\nSCM Type:\t%s", scm.GetSCMType())
		fmt.Printf("\n%s directory:\t%s", scm.GetSCMType(), scmdir)
	} else {
		fmt.Printf("\n\nSCM Type: None (purge and commit commands unavailable)")
	}

	fmt.Printf("\n")
}