Add `tea clone` #411

Merged
lunny merged 14 commits from noerw/tea:add-repo-clone into master 12 months ago
noerw commented 1 year ago
Collaborator

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 1 year ago
noerw added the kind/feature label 1 year ago
noerw added 1 commit 1 year ago
continuous-integration/drone/pr Build is passing Details
662f90e979
add tea repo clone
lunny reviewed 1 year ago
// 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` 1 year ago
noerw added 3 commits 1 year ago
noerw changed title from WIP: Add `tea repo clone` to Add `tea repo clone` 1 year ago
Poster
Collaborator

@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 1 year ago
continuous-integration/drone/pr Build is failing Details
13600ad4a9
Merge branch 'master' into add-repo-clone
techknowlogick added 1 commit 1 year ago
continuous-integration/drone/pr Build is passing Details
e295f32625
Merge branch 'master' into add-repo-clone
zeripath approved these changes 12 months ago
noerw added 1 commit 12 months ago
continuous-integration/drone/pr Build is passing Details
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 12 months ago
continuous-integration/drone/pr Build is passing Details
96d2caec52
Merge branch 'master' into add-repo-clone
noerw added 3 commits 12 months ago
b7ab1cf95e
refactor URL handling + test git.ParseURL
continuous-integration/drone/pr Build is failing Details
b8cec7336f
accept repo slug as first arg instead of `--repo`
lunny approved these changes 12 months ago
noerw added 1 commit 12 months ago
continuous-integration/drone/pr Build is failing Details
0674a1c6f4
fix docs
noerw added 1 commit 12 months ago
continuous-integration/drone/pr Build is passing Details
0bdd95adbc
lint
noerw added 1 commit 12 months ago
continuous-integration/drone/pr Build is passing Details
b4e302c2f9
improve help layout
lunny changed title from Add `tea repo clone` to Add `tea clone` 12 months ago
lunny merged commit 819cc1ab21 into master 12 months ago
lunny referenced this issue from a commit 12 months ago
noerw deleted branch add-repo-clone 12 months ago

Reviewers

zeripath approved these changes 12 months ago
lunny approved these changes 12 months ago
continuous-integration/drone/pr Build is passing
The pull request has been merged as 819cc1ab21.
Sign in to join this conversation.
Loading…
There is no content yet.