Mirror: Labels will be not migrated thru /repos/migrate API call #7045

Closed
opened 2025-11-02 07:14:19 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @somera on GitHub (Mar 21, 2021).

  • Gitea version (or commit ref): 1.13.4
  • Git version:
  • Operating system:
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:

I'm using python script to migrate mirrors into Gitea

for (u, n) in zip(repo_urls, repo_names):
    print("repo_url=", u," / repo_name=", n)

    # Mirror to Gitea if I haven't forked this repository from elsewhere
    m = {
        "repo_name"         : n,
        "clone_addr"        : u,
        "mirror"            : True,
        "private"           : False,
        "issues"            : True,
        "labels"            : True,
        "milestones"        : True,
        "pull_requests"     : True,
        "releases"          : True,
        "wiki"              : True,
        "uid"               : 284
    }

    jsonstring = json.dumps(m)

    print("jsonstring...", jsonstring)

    r = session.post("{0}/repos/migrate".format(gitea_url), data=jsonstring)
    if r.status_code != 201:            # if not CREATED
        if r.status_code == 409:        # repository exists
            continue
        print(r.status_code, r.text, jsonstring)

Labels is set to TRUE, but labels will be not migrated. If I do the same thru Gitea UI -> Github mirror than labels are migrated.

Are all the values for the boolean parameters default values?

image

Originally created by @somera on GitHub (Mar 21, 2021). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq) 5. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.13.4 - Git version: - Operating system: <!-- Please include information on whether you built gitea yourself, used one of our downloads or are using some other package --> <!-- Please also tell us how you are running gitea, e.g. if it is being run from docker, a command-line, systemd etc. ---> <!-- If you are using a package or systemd tell us what distribution you are using --> - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - Log gist: <!-- It really is important to provide pertinent logs --> <!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems --> <!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini --> I'm using python script to migrate mirrors into Gitea ``` for (u, n) in zip(repo_urls, repo_names): print("repo_url=", u," / repo_name=", n) # Mirror to Gitea if I haven't forked this repository from elsewhere m = { "repo_name" : n, "clone_addr" : u, "mirror" : True, "private" : False, "issues" : True, "labels" : True, "milestones" : True, "pull_requests" : True, "releases" : True, "wiki" : True, "uid" : 284 } jsonstring = json.dumps(m) print("jsonstring...", jsonstring) r = session.post("{0}/repos/migrate".format(gitea_url), data=jsonstring) if r.status_code != 201: # if not CREATED if r.status_code == 409: # repository exists continue print(r.status_code, r.text, jsonstring) ``` Labels is set to TRUE, but labels will be not migrated. If I do the same thru Gitea UI -> Github mirror than labels are migrated. Are all the values for the boolean parameters default values? ![image](https://user-images.githubusercontent.com/8334250/111912220-00875380-8a69-11eb-9035-b400c2e358ec.png)
GiteaMirror added the issue/not-a-bugmodifies/api labels 2025-11-02 07:14:20 -06:00
Author
Owner

@lunny commented on GitHub (Mar 22, 2021):

For mirrors, only git data and wiki data transfer are implemented. Other options are only for github/gitlab/gitea/gogs migrations.

@lunny commented on GitHub (Mar 22, 2021): For mirrors, only git data and wiki data transfer are implemented. Other options are only for github/gitlab/gitea/gogs migrations.
Author
Owner

@somera commented on GitHub (Mar 22, 2021):

For mirrors, only git data and wiki data transfer are implemented. Other options are only for github/gitlab/gitea/gogs migrations.

ok. But if "service" isn't set in json request and it's an GitHub URL, which settings will be used?

@somera commented on GitHub (Mar 22, 2021): > For mirrors, only git data and wiki data transfer are implemented. Other options are only for github/gitlab/gitea/gogs migrations. ok. But if "service" isn't set in json request and it's an GitHub URL, which settings will be used?
Author
Owner

@noerw commented on GitHub (Mar 26, 2021):

service defaults to "git", as it is a common denominator.
If you want to autodetect service based on repo URL, you're very welcome to implement that! ;)
Relevant code:
dc56fb7c84/modules/convert/utils.go (L26)

@noerw commented on GitHub (Mar 26, 2021): `service` defaults to `"git"`, as it is a common denominator. If you want to autodetect service based on repo URL, you're very welcome to implement that! ;) Relevant code: https://github.com/go-gitea/gitea/blob/dc56fb7c84bb123614fb190319081e5a9bc18133/modules/convert/utils.go#L26
Author
Owner

@somera commented on GitHub (Mar 26, 2021):

service defaults to "git", as it is a common denominator.
If you want to autodetect service based on repo URL, you're very welcome to implement that! ;)

Lerning go is on my ToDo list ;)

@somera commented on GitHub (Mar 26, 2021): > `service` defaults to `"git"`, as it is a common denominator. > If you want to autodetect service based on repo URL, you're very welcome to implement that! ;) Lerning go is on my ToDo list ;)
Author
Owner

@zeripath commented on GitHub (Mar 26, 2021):

OK so this is actually a feature request and not a bug - therefore I'm going to close this as not-a-bug @somera please consider re-opening with a feature request.

@zeripath commented on GitHub (Mar 26, 2021): OK so this is actually a feature request and not a bug - therefore I'm going to close this as not-a-bug @somera please consider re-opening with a feature request.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7045