aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bridge/github/export.go27
-rw-r--r--cache/bug_cache.go2
-rw-r--r--doc/man/git-bug-bridge-push.129
-rw-r--r--doc/man/git-bug-bridge.12
-rw-r--r--doc/md/git-bug_bridge.md1
-rw-r--r--doc/md/git-bug_bridge_push.md22
-rw-r--r--misc/bash_completion/git-bug21
-rw-r--r--misc/zsh_completion/git-bug49
8 files changed, 140 insertions, 13 deletions
diff --git a/bridge/github/export.go b/bridge/github/export.go
index 71790031..38df9caf 100644
--- a/bridge/github/export.go
+++ b/bridge/github/export.go
@@ -22,6 +22,9 @@ import (
type githubExporter struct {
conf core.Configuration
+ // number of exported bugs
+ exportedBugs int
+
// export only bugs taged with one of these origins
onlyOrigins []string
@@ -166,12 +169,11 @@ func (ge *githubExporter) exportBug(b *cache.BugCache, since time.Time) error {
// get github bug ID
githubID, ok := createOp.GetMetadata(keyGithubId)
if ok {
- githubURL, ok := createOp.GetMetadata(keyGithubId)
+ githubURL, ok := createOp.GetMetadata(keyGithubUrl)
if !ok {
// if we find github ID, github URL must be found too
panic("expected to find github issue URL")
}
-
// will be used to mark operation related to a bug as exported
bugGithubID = githubID
bugGithubURL = githubURL
@@ -191,7 +193,7 @@ func (ge *githubExporter) exportBug(b *cache.BugCache, since time.Time) error {
// create bug
id, url, err := createGithubIssue(client, ge.repositoryID, createOp.Title, createOp.Message)
if err != nil {
- return fmt.Errorf("creating exporting github issue %v", err)
+ return fmt.Errorf("exporting github issue: %v", err)
}
hash, err := createOp.Hash()
@@ -263,11 +265,13 @@ func (ge *githubExporter) exportBug(b *cache.BugCache, since time.Time) error {
}
case *bug.EditCommentOperation:
+
opr := op.(*bug.EditCommentOperation)
targetHash := opr.Target.String()
// Since github doesn't consider the issue body as a comment
if targetHash == bugCreationHash {
+
// case bug creation operation: we need to edit the Github issue
if err := updateGithubIssueBody(client, bugGithubID, opr.Message); err != nil {
return fmt.Errorf("editing issue: %v", err)
@@ -277,6 +281,7 @@ func (ge *githubExporter) exportBug(b *cache.BugCache, since time.Time) error {
url = bugGithubURL
} else {
+
// case comment edition operation: we need to edit the Github comment
commentID, ok := ge.cachedIDs[targetHash]
if !ok {
@@ -552,7 +557,7 @@ func (ge *githubExporter) getLabelsIDs(repositoryID string, labels []bug.Label)
// create a github issue and return it ID
func createGithubIssue(gc *githubv4.Client, repositoryID, title, body string) (string, string, error) {
m := &createIssueMutation{}
- input := &githubv4.CreateIssueInput{
+ input := githubv4.CreateIssueInput{
RepositoryID: repositoryID,
Title: githubv4.String(title),
Body: (*githubv4.String)(&body),
@@ -569,7 +574,7 @@ func createGithubIssue(gc *githubv4.Client, repositoryID, title, body string) (s
// add a comment to an issue and return it ID
func addCommentGithubIssue(gc *githubv4.Client, subjectID string, body string) (string, string, error) {
m := &addCommentToIssueMutation{}
- input := &githubv4.AddCommentInput{
+ input := githubv4.AddCommentInput{
SubjectID: subjectID,
Body: githubv4.String(body),
}
@@ -584,7 +589,7 @@ func addCommentGithubIssue(gc *githubv4.Client, subjectID string, body string) (
func editCommentGithubIssue(gc *githubv4.Client, commentID, body string) (string, string, error) {
m := &updateIssueCommentMutation{}
- input := &githubv4.UpdateIssueCommentInput{
+ input := githubv4.UpdateIssueCommentInput{
ID: commentID,
Body: githubv4.String(body),
}
@@ -606,7 +611,7 @@ func updateGithubIssueStatus(gc *githubv4.Client, id string, status bug.Status)
state = githubv4.IssueStateOpen
}
- input := &githubv4.UpdateIssueInput{
+ input := githubv4.UpdateIssueInput{
ID: id,
State: &state,
}
@@ -620,7 +625,7 @@ func updateGithubIssueStatus(gc *githubv4.Client, id string, status bug.Status)
func updateGithubIssueBody(gc *githubv4.Client, id string, body string) error {
m := &updateIssueMutation{}
- input := &githubv4.UpdateIssueInput{
+ input := githubv4.UpdateIssueInput{
ID: id,
Body: (*githubv4.String)(&body),
}
@@ -634,7 +639,7 @@ func updateGithubIssueBody(gc *githubv4.Client, id string, body string) error {
func updateGithubIssueTitle(gc *githubv4.Client, id, title string) error {
m := &updateIssueMutation{}
- input := &githubv4.UpdateIssueInput{
+ input := githubv4.UpdateIssueInput{
ID: id,
Title: (*githubv4.String)(&title),
}
@@ -654,7 +659,7 @@ func (ge *githubExporter) updateGithubIssueLabels(gc *githubv4.Client, labelable
}
m := &addLabelsToLabelableMutation{}
- inputAdd := &githubv4.AddLabelsToLabelableInput{
+ inputAdd := githubv4.AddLabelsToLabelableInput{
LabelableID: labelableID,
LabelIDs: addedIDs,
}
@@ -670,7 +675,7 @@ func (ge *githubExporter) updateGithubIssueLabels(gc *githubv4.Client, labelable
}
m2 := &removeLabelsFromLabelableMutation{}
- inputRemove := &githubv4.RemoveLabelsFromLabelableInput{
+ inputRemove := githubv4.RemoveLabelsFromLabelableInput{
LabelableID: labelableID,
LabelIDs: removedIDs,
}
diff --git a/cache/bug_cache.go b/cache/bug_cache.go
index 36f2139e..758fb0b7 100644
--- a/cache/bug_cache.go
+++ b/cache/bug_cache.go
@@ -260,7 +260,7 @@ func (c *BugCache) SetMetadata(target git.Hash, newMetadata map[string]string) (
return nil, err
}
- return c.SetMetadataRaw(author, time.Now().Unix(), target, nil)
+ return c.SetMetadataRaw(author, time.Now().Unix(), target, newMetadata)
}
func (c *BugCache) SetMetadataRaw(author *IdentityCache, unixTime int64, target git.Hash, newMetadata map[string]string) (*bug.SetMetadataOperation, error) {
diff --git a/doc/man/git-bug-bridge-push.1 b/doc/man/git-bug-bridge-push.1
new file mode 100644
index 00000000..1257781b
--- /dev/null
+++ b/doc/man/git-bug-bridge-push.1
@@ -0,0 +1,29 @@
+.TH "GIT-BUG" "1" "Apr 2019" "Generated from git-bug's source code" ""
+.nh
+.ad l
+
+
+.SH NAME
+.PP
+git\-bug\-bridge\-push \- Push updates.
+
+
+.SH SYNOPSIS
+.PP
+\fBgit\-bug bridge push [<name>] [flags]\fP
+
+
+.SH DESCRIPTION
+.PP
+Push updates.
+
+
+.SH OPTIONS
+.PP
+\fB\-h\fP, \fB\-\-help\fP[=false]
+ help for push
+
+
+.SH SEE ALSO
+.PP
+\fBgit\-bug\-bridge(1)\fP
diff --git a/doc/man/git-bug-bridge.1 b/doc/man/git-bug-bridge.1
index 9c198716..dfede4e0 100644
--- a/doc/man/git-bug-bridge.1
+++ b/doc/man/git-bug-bridge.1
@@ -26,4 +26,4 @@ Configure and use bridges to other bug trackers.
.SH SEE ALSO
.PP
-\fBgit\-bug(1)\fP, \fBgit\-bug\-bridge\-configure(1)\fP, \fBgit\-bug\-bridge\-pull(1)\fP, \fBgit\-bug\-bridge\-rm(1)\fP
+\fBgit\-bug(1)\fP, \fBgit\-bug\-bridge\-configure(1)\fP, \fBgit\-bug\-bridge\-pull(1)\fP, \fBgit\-bug\-bridge\-push(1)\fP, \fBgit\-bug\-bridge\-rm(1)\fP
diff --git a/doc/md/git-bug_bridge.md b/doc/md/git-bug_bridge.md
index 7d01a300..dfd61e29 100644
--- a/doc/md/git-bug_bridge.md
+++ b/doc/md/git-bug_bridge.md
@@ -21,5 +21,6 @@ git-bug bridge [flags]
* [git-bug](git-bug.md) - A bug tracker embedded in Git.
* [git-bug bridge configure](git-bug_bridge_configure.md) - Configure a new bridge.
* [git-bug bridge pull](git-bug_bridge_pull.md) - Pull updates.
+* [git-bug bridge push](git-bug_bridge_push.md) - Push updates.
* [git-bug bridge rm](git-bug_bridge_rm.md) - Delete a configured bridge.
diff --git a/doc/md/git-bug_bridge_push.md b/doc/md/git-bug_bridge_push.md
new file mode 100644
index 00000000..35436dd6
--- /dev/null
+++ b/doc/md/git-bug_bridge_push.md
@@ -0,0 +1,22 @@
+## git-bug bridge push
+
+Push updates.
+
+### Synopsis
+
+Push updates.
+
+```
+git-bug bridge push [<name>] [flags]
+```
+
+### Options
+
+```
+ -h, --help help for push
+```
+
+### SEE ALSO
+
+* [git-bug bridge](git-bug_bridge.md) - Configure and use bridges to other bug trackers.
+
diff --git a/misc/bash_completion/git-bug b/misc/bash_completion/git-bug
index 741dcc49..ae3242e5 100644
--- a/misc/bash_completion/git-bug
+++ b/misc/bash_completion/git-bug
@@ -351,6 +351,26 @@ _git-bug_bridge_pull()
noun_aliases=()
}
+_git-bug_bridge_push()
+{
+ last_command="git-bug_bridge_push"
+
+ command_aliases=()
+
+ commands=()
+
+ flags=()
+ two_word_flags=()
+ local_nonpersistent_flags=()
+ flags_with_completion=()
+ flags_completion=()
+
+
+ must_have_one_flag=()
+ must_have_one_noun=()
+ noun_aliases=()
+}
+
_git-bug_bridge_rm()
{
last_command="git-bug_bridge_rm"
@@ -380,6 +400,7 @@ _git-bug_bridge()
commands=()
commands+=("configure")
commands+=("pull")
+ commands+=("push")
commands+=("rm")
flags=()
diff --git a/misc/zsh_completion/git-bug b/misc/zsh_completion/git-bug
index ed676724..97fb27c5 100644
--- a/misc/zsh_completion/git-bug
+++ b/misc/zsh_completion/git-bug
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
#compdef _git-bug git-bug
@@ -394,3 +395,51 @@ function _git-bug_webui {
'(-p --port)'{-p,--port}'[Port to listen to (default is random)]:'
}
+=======
+#compdef git-bug
+
+_arguments \
+ '1: :->level1' \
+ '2: :->level2' \
+ '3: :_files'
+case $state in
+ level1)
+ case $words[1] in
+ git-bug)
+ _arguments '1: :(add bridge commands comment deselect label ls ls-id ls-label pull push select show status termui title user version webui)'
+ ;;
+ *)
+ _arguments '*: :_files'
+ ;;
+ esac
+ ;;
+ level2)
+ case $words[2] in
+ bridge)
+ _arguments '2: :(configure pull push rm)'
+ ;;
+ comment)
+ _arguments '2: :(add)'
+ ;;
+ label)
+ _arguments '2: :(add rm)'
+ ;;
+ status)
+ _arguments '2: :(close open)'
+ ;;
+ title)
+ _arguments '2: :(edit)'
+ ;;
+ user)
+ _arguments '2: :(adopt create ls)'
+ ;;
+ *)
+ _arguments '*: :_files'
+ ;;
+ esac
+ ;;
+ *)
+ _arguments '*: :_files'
+ ;;
+esac
+>>>>>>> 3daac46... update man docs and completion scripts