support create agit flow pull request (#867)

while looks the alibaba has not maintain
[`git-repo-go`](https://github.com/alibaba/git-repo-go/)
tool, to make agit flow pull requst can be create quickly.
add creating agit flow pull request feature
in tea tool

example:

```SHELL
tea pulls create --agit --remote=origin --topic=test-topic
--title="hello world" --description="test1
test 2
test 3"
```

Signed-off-by: a1012112796 <1012112796@qq.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/867
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-committed-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
a1012112796
2026-02-03 20:36:04 +00:00
committed by techknowlogick
parent 82d8a14c73
commit 0d5bf60632
6 changed files with 209 additions and 0 deletions

View File

@@ -4,6 +4,8 @@
package git
import (
"net/url"
"github.com/go-git/go-git/v5"
)
@@ -33,3 +35,13 @@ func RepoFromPath(path string) (*TeaRepo, error) {
return &TeaRepo{repo}, nil
}
// RemoteURL returns the URL of the given remote
func (r TeaRepo) RemoteURL(remoteName string) (*url.URL, error) {
remote, err := r.Remote(remoteName)
if err != nil {
return nil, err
}
return url.Parse(remote.Config().URLs[0])
}