mardi 8 avril 2014

python - versionnage API tout en conservant l'historique git - Stack Overflow


I currently have a v1 API and have updated and created new scripts for v2. The API is consumed by other developers and consists of a bunch of scripts. Before migrating and adding v2 I want to make sure I have a successful versioning strategy to go ahead with.


Currently, there is a bash script called before using the API, with which you can supply the version # or by default gives you the most recent version. Originally, I intended to have different subfolders for each different version, but for scripts that do not change between revisions and scripts that get content added to them, the git history will not be preserved correctly as the original file will still reside in the v1 subdir and will not be 'git mv'ed. This is obviously not the best way but I can't think of a better way currently.


Any recommendations will be helpful but one restriction is that we cannot have a git submodule with different branches. There are no other restrictions (e.g. the bash file used for setup can be deleted) as long as the scripts are accessible. Thanks!


EDIT: We also have scripts above the "API" directory that are part of the same repo that call into the API (we are consumers of our own API). The changes to these files need to be visible when using any version of the API and cannot just be seen in the latest version (related to tags in the repo)




I think you want to use tags in your git repository. For each version of your api, use git tag vn and you don't need to maintain earlier versions of your files. You can access all files at a certain version just using git checkout vn.


If you use a remote repository, you need to use the flag --tags to send the tags to the remote repository, ie, git push --tags.



I currently have a v1 API and have updated and created new scripts for v2. The API is consumed by other developers and consists of a bunch of scripts. Before migrating and adding v2 I want to make sure I have a successful versioning strategy to go ahead with.


Currently, there is a bash script called before using the API, with which you can supply the version # or by default gives you the most recent version. Originally, I intended to have different subfolders for each different version, but for scripts that do not change between revisions and scripts that get content added to them, the git history will not be preserved correctly as the original file will still reside in the v1 subdir and will not be 'git mv'ed. This is obviously not the best way but I can't think of a better way currently.


Any recommendations will be helpful but one restriction is that we cannot have a git submodule with different branches. There are no other restrictions (e.g. the bash file used for setup can be deleted) as long as the scripts are accessible. Thanks!


EDIT: We also have scripts above the "API" directory that are part of the same repo that call into the API (we are consumers of our own API). The changes to these files need to be visible when using any version of the API and cannot just be seen in the latest version (related to tags in the repo)



I think you want to use tags in your git repository. For each version of your api, use git tag vn and you don't need to maintain earlier versions of your files. You can access all files at a certain version just using git checkout vn.


If you use a remote repository, you need to use the flag --tags to send the tags to the remote repository, ie, git push --tags.


0 commentaires:

Enregistrer un commentaire