Add tea clone #411

Merged
lunny merged 14 commits from noerw/tea:add-repo-clone into master 2021-10-18 12:09:28 +00:00
Member

Adds a new subcommand to clone repos:

tea clone --login try --depth 1 norwin/test
tea clone gitea/tea
tea clone noerw/tea               # will set up `master` to track `upstream` remote
tea clone try.gitea.io/noerw/test # will automatically set --login

This is just a replacement for git clone with small benefits:

  • does not depend on git, as tea ships with go-git
  • spares you typing of URLs and autoselects https/ssh based on your login config
  • forked repos: set up origin + upstream remote
Adds a new subcommand to clone repos: ``` tea clone --login try --depth 1 norwin/test tea clone gitea/tea tea clone noerw/tea # will set up `master` to track `upstream` remote tea clone try.gitea.io/noerw/test # will automatically set --login ``` This is just a replacement for `git clone` with small benefits: - [x] does not depend on `git`, as tea ships with go-git - [x] spares you typing of URLs and autoselects https/ssh based on your login config - [x] forked repos: set up origin + upstream remote
noerw added this to the v0.9.0 milestone 2021-09-25 10:35:04 +00:00
noerw added the
kind
feature
label 2021-09-25 10:35:04 +00:00
noerw added 1 commit 2021-09-25 10:35:04 +00:00
All checks were successful
continuous-integration/drone/pr Build is passing
662f90e979
add tea repo clone
lunny reviewed 2021-09-26 00:45:52 +00:00
@ -0,0 +1,74 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
Owner

2021

2021
noerw marked this conversation as resolved
Owner

Could we only input owner name and repo name? Or include the site name.

Could we only input owner name and repo name? Or include the site name.
noerw changed title from Add `tea repo clone` to WIP: Add `tea repo clone` 2021-09-26 10:37:47 +00:00
noerw added 3 commits 2021-09-28 10:29:27 +00:00
noerw changed title from WIP: Add `tea repo clone` to Add `tea repo clone` 2021-09-28 10:29:46 +00:00
Author
Member

@lunny you mean tea repo clone gitea.com/gitea/tea or tea repo clone gitea/tea?
I think that's nicer too, but using --repo is consistent with the other tea repo * commands, they all don't make use of arguments. Maybe a change to all the repo subcommands is needed.. see #430

@lunny you mean `tea repo clone gitea.com/gitea/tea` or `tea repo clone gitea/tea`? I think that's nicer too, but using `--repo` is consistent with the other `tea repo *` commands, they all don't make use of arguments. Maybe a change to all the repo subcommands is needed.. see #430
noerw added 1 commit 2021-10-03 11:16:08 +00:00
Some checks failed
continuous-integration/drone/pr Build is failing
13600ad4a9
Merge branch 'master' into add-repo-clone
techknowlogick added 1 commit 2021-10-04 17:44:39 +00:00
All checks were successful
continuous-integration/drone/pr Build is passing
e295f32625
Merge branch 'master' into add-repo-clone
zeripath approved these changes 2021-10-10 14:58:16 +00:00
noerw added 1 commit 2021-10-12 06:46:27 +00:00
All checks were successful
continuous-integration/drone/pr Build is passing
ff48a84007
Merge branch 'master' into add-repo-clone
Owner

@lunny you mean tea repo clone gitea.com/gitea/tea or tea repo clone gitea/tea?
I think that's nicer too, but using --repo is consistent with the other tea repo * commands, they all don't make use of arguments. Maybe a change to all the repo subcommands is needed.. see #430

Hm, it seems the command is not even shorter than git clone.

tea clone gitea/tea if there is only one login is OK.

If there are more than 1 sites, and a --login is not given, we can list all sites which contains the repository.

i.e. I have two logins, one is https://gitea.com another is https://try.gitea.io. If gitea/tea is only at https://gitea.com, then

tea clone gitea/tea

will smartly clone it from https://gitea.com.

And once we also created a repo gitea/tea in https://try.gitea.io ,
Then the command will list all logins like below:

We found two repository from different sites, chose one to cloen:
[1] https://gitea.com/gitea/tea
[2] https://try.gitea.io/gitea/tea

Chose[1]:

Then if you type 1 or 2 or just enter to use default one. The clone will begin.

> @lunny you mean `tea repo clone gitea.com/gitea/tea` or `tea repo clone gitea/tea`? > I think that's nicer too, but using `--repo` is consistent with the other `tea repo *` commands, they all don't make use of arguments. Maybe a change to all the repo subcommands is needed.. see #430 Hm, it seems the command is not even shorter than `git clone`. `tea clone gitea/tea` if there is only one login is OK. If there are more than 1 sites, and a `--login` is not given, we can list all sites which contains the repository. i.e. I have two logins, one is `https://gitea.com` another is `https://try.gitea.io`. If `gitea/tea` is only at `https://gitea.com`, then ``` tea clone gitea/tea ``` will smartly clone it from https://gitea.com. And once we also created a repo `gitea/tea` in https://try.gitea.io , Then the command will list all logins like below: ``` We found two repository from different sites, chose one to cloen: [1] https://gitea.com/gitea/tea [2] https://try.gitea.io/gitea/tea Chose[1]: ```` Then if you type 1 or 2 or just enter to use default one. The clone will begin.
noerw added 1 commit 2021-10-18 07:28:37 +00:00
All checks were successful
continuous-integration/drone/pr Build is passing
96d2caec52
Merge branch 'master' into add-repo-clone
noerw added 3 commits 2021-10-18 09:41:05 +00:00
b7ab1cf95e refactor URL handling + test git.ParseURL
in preparation to handle more cases for `tea clone <url-like>`
Some checks failed
continuous-integration/drone/pr Build is failing
b8cec7336f
accept repo slug as first arg instead of `--repo`
and accept various formats (tea, gitea/tea, gitea.com/gitea/tea, ...)
lunny approved these changes 2021-10-18 09:50:38 +00:00
noerw added 1 commit 2021-10-18 09:50:55 +00:00
Some checks failed
continuous-integration/drone/pr Build is failing
0674a1c6f4
fix docs
noerw added 1 commit 2021-10-18 09:52:45 +00:00
All checks were successful
continuous-integration/drone/pr Build is passing
0bdd95adbc
lint
noerw added 1 commit 2021-10-18 10:00:04 +00:00
All checks were successful
continuous-integration/drone/pr Build is passing
b4e302c2f9
improve help layout
lunny changed title from Add `tea repo clone` to Add `tea clone` 2021-10-18 12:07:18 +00:00
lunny merged commit 819cc1ab21 into master 2021-10-18 12:09:28 +00:00
lunny referenced this issue from a commit 2021-10-18 12:09:28 +00:00
noerw deleted branch add-repo-clone 2021-10-18 12:23:45 +00:00
Sign in to join this conversation.
No description provided.