#3176 section 'Renaming your repository' added into tips&tricks in docs
Opened 5 years ago by clime. Modified 2 months ago
clime/pagure master  into  master

file modified
+109
@@ -77,3 +77,112 @@ 

  ~~~~~~~~~

  https://pagure.io/SSSD/sssd/issues?status=Open&search_pattern=review%3ATrue

  https://pagure.io/pagure/issues?status=Open&search_pattern=tags%3Aeasyfix

+ 

+ Renaming your repository

+ ------------------------

+ 

+ 1. Create a new repository with desired name. In this howto, we will

+    be using ``move-repo-new`` name for the new repository and ``move-repo``

I know this is outdated/abandoned, but just as a general form thing, couldn't
we use $OLDREPO and $NEWREPO (respectively) for the names, just to
make it 1000% clear to users that they shouldn't literally type (or copy-paste)
things like move-repo and move-repo-new into their commands?

It seems way too easy to mistake a string like move-repo-new as a command
you're sending to Pagure, rather than a placeholder repo name.

+    for the original repository.

+ 

+ 2. Go to 'Settings' page of your new repository, find 'Hooks'

+    section and Activate 'Pagure requests'. Do the same for 'Pagure tickets'.

+    Without this step, you won't be able to successfully import tickets or PRs.

+ 

+ 3. In your original locally cloned repository, run:

+ 

+ ::

+ 

+     git remote add move-repo-new ssh://git@pagure.io/move-repo-new.git

+     git push -u move-repo-new master

+ 

+ 

+    This will push the code into your new repository.

+ 

+ 4. If you have documentation enabled in the original project, enable (activate) it

+    also in the new project and run:

+ 

+ ::

+ 

+     git clone ssh://git@pagure.io/docs/move-repo.git move-repo-docs

+     cd move-repo-docs

+     git remote add move-repo-new-docs ssh://git@pagure.io/docs/move-repo-new.git

+     git push -u move-repo-new-docs master

+ 

+ 5. Continue by cloning issues (tickets) of the original repo if you have issues enabled there:

+ 

+ ::

+ 

+    git clone ssh://git@pagure.io/tickets/move-repo.git move-repo-tickets

+ 

+ 6. Now you need to do something really weird, in the cloned tickets repos, there will be files like:

+ 

+ ::

+ 

+     3b3860de09524f848583fb39293f58ba

+     8b61af2f4125458dbd1bfa2918a08d26

+ 

+ Those files contain tickets metadata. You need to change the name of each file

+ Change some character in the filename string for each file to some other character.

+ 

+ Then commit the changes.

+ 

+ 7. Push the changes to the remote tickets repository:

+ 

+ ::

+ 

+     git remote add move-repo-new-tickets ssh://git@pagure.io/tickets/move-repo-new.git

+     git push -u move-repo-new-tickets master

+ 

+ You should be now receiving email with subject '[Pagure] Issue import report' to the email address

+ you have set in Pagure. Upon successful import, the issues will appear in Pagure's GUI.

+ 

+ 8. Now clone pull requests of the original repository:

+ 

+ ::

+ 

+     git clone ssh://git@pagure.io/requests/move-repo.git move-repo-requests

+ 

+ 9. Again, you will need to do some manual modifications and for PRs they are much more tedious.

+    Keep your focus sharp here.

+ 

+ Individual PRs are again stored in files:

+ 

+ ::

+ 

+     30206d385ef14316a364169c7cf024f7

+ 

+ First change the filename (arbitrarily as before for issues). Now, go to

Isn't that achievable via the issue git repo? Not everyone using pagure will use fedmsg and datagrepper :s

clime commented 5 years ago

I don't see project ID in the issue tickets. I thought fedmsg for a new project is always being sent so I thought this is not such a big deal.

fedmsg messages are sent, but this recipe won't work on pagure instances not using fedmsg :(

clime commented 5 years ago

ah ok. Well not sure. how to get the project ID by another way.

you can use Pagure API for that : '''curl -L https://pagure.io/api/0/namespace/projectname | jq '.id''''

+ https://apps.fedoraproject.org/datagrepper/raw?topic=io.pagure.prod.pagure.project.new and find out ID

+ of the newly created project. Then open the renamed file and replace project "id" field

+ value with the ID of your new project (the one you have just found out from datagrepper).

+ 

+ Note that in the file there might be "id" field also for the parent of the fork from which the Pull Request

+ was issued (which will be of the same value as the "id" you have just replaced) and also for the fork itself.

+ Keep that untouched.

+ 

+ Next, substitute name of the old (original) project with the new project name. Again, keep the values

+ for the fork and its parent unchanged if the fork data are present.

+ 

+ Finally, change the "uid" value to the new filename (in other words, to the current name of the file

+ you are modifying).

+ 

+ Finally, commit all changes you have made.

+ 

+ 10. Push the changes to the remote requests repository:

+ 

+ ::

+ 

+     git remote add move-repo-new-requests ssh://git@pagure.io/requests/move-repo-new.git

+     git push -u move-repo-new-requests master

+ 

+ You might get some fatal errors like:

+ 

+ ::

+ 

+     remote: fatal: Path 'dda269a9f6524daebf9257530cfe7d6f' does not exist in 'HEAD'

+ 

+ You can just ignore it.

+ 

+ This should be all. If you encouter Pagure Database errors about Unique constraint violated,

+ you are in trouble. If you cannot get out of it, you will need to bump id of the pull request.

Documentation to Renaming repositories added into Tips & Tricks section.

Isn't that achievable via the issue git repo? Not everyone using pagure will use fedmsg and datagrepper :s

I don't see project ID in the issue tickets. I thought fedmsg for a new project is always being sent so I thought this is not such a big deal.

fedmsg messages are sent, but this recipe won't work on pagure instances not using fedmsg :(

ah ok. Well not sure. how to get the project ID by another way.

you can use Pagure API for that : '''curl -L https://pagure.io/api/0/namespace/projectname | jq '.id''''

pretty please pagure-ci rebuild

2 years ago

I know this is outdated/abandoned, but just as a general form thing, couldn't
we use $OLDREPO and $NEWREPO (respectively) for the names, just to
make it 1000% clear to users that they shouldn't literally type (or copy-paste)
things like move-repo and move-repo-new into their commands?

It seems way too easy to mistake a string like move-repo-new as a command
you're sending to Pagure, rather than a placeholder repo name.