Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bare repo script #146

Merged
merged 5 commits into from
Mar 1, 2023
Merged

Bare repo script #146

merged 5 commits into from
Mar 1, 2023

Conversation

wnwright
Copy link
Contributor

@wnwright wnwright commented Feb 24, 2023

There are a lot of IOCs that are not properly version controlled since we moved from svn to git. Often, I run into IOCs that do not have a hutch specific bare repo setup, so I made this script to help facilitate the process of creating that bare repo and the subsequent steps afterwards.

This script:

  1. Initializes the local repository
  2. Checks in the .cfg file, Makefile and .gitignore
  3. Creates the bare repo in the proper location using eco_tools git-bare-repo script
  4. Sets this newly created bare repo as the remote origin and sets it as the upstream

Motivation and Context

As mentioned above

How Has This Been Tested?

This has been tested once with the Smarpod IOC, which I had yet to create a hutch bare repo for. Worked perfectly.

Where Has This Been Documented?

Code includes simple explanations for how to use the script.

If this script is redundant, or could be useful in another script or repository, feel free to shoot this down.

@wnwright wnwright requested review from klauer and ZLLentz February 24, 2023 02:07
Copy link
Member

@ZLLentz ZLLentz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have two concrete suggestions and some musing for future follow-ups

Ex. new_bare_repo rix new_device
(Creates a new bare repo in /afs/slac.stanford.edu/g/cd/swe/git/repos/package/epics/ioc/rix/ named "new_device.git")

You also might need to run kinit and aklog before hand!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope for this PR, I'm thinking we might want to add an engineering tools script that checks if kinit/aklog needs to be run (and optionally, runs it). This is doable using the output of the klist command.

Would something like this have been useful when writing this script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I am not even sure when to run kinit or not... It's usually something I only run when I get an error message with git that I can't explain otherwise

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added an issue for this, I might get around to it at some point: #147

scripts/new_bare_repo Outdated Show resolved Hide resolved
scripts/new_bare_repo Outdated Show resolved Hide resolved
scripts/new_bare_repo Show resolved Hide resolved
Comment on lines 37 to 39
git-bare-repo /afs/slac.stanford.edu/g/cd/swe/git/repos/package/epics/ioc/${HUTCH}/${REPO}.git
git remote add origin /afs/slac.stanford.edu/g/cd/swe/git/repos/package/epics/ioc/${HUTCH}/${REPO}.git
git push -u origin master
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope: a future version of this script could help set up a github repo instead of an afs repo.
At some ill-defined future point we were going to integrate code review into our IOC process.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to leave this git push step be manual, just in case the script does something you don't expect

scripts/new_bare_repo Outdated Show resolved Hide resolved
scripts/new_bare_repo Show resolved Hide resolved
scripts/new_bare_repo Outdated Show resolved Hide resolved
scripts/new_bare_repo Outdated Show resolved Hide resolved
Comment on lines 37 to 39
git-bare-repo /afs/slac.stanford.edu/g/cd/swe/git/repos/package/epics/ioc/${HUTCH}/${REPO}.git
git remote add origin /afs/slac.stanford.edu/g/cd/swe/git/repos/package/epics/ioc/${HUTCH}/${REPO}.git
git push -u origin master
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to leave this git push step be manual, just in case the script does something you don't expect

scripts/new_bare_repo Outdated Show resolved Hide resolved
Copy link
Member

@ZLLentz ZLLentz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good/clean/useful 👍

@ZLLentz
Copy link
Member

ZLLentz commented Mar 1, 2023

@klauer anything else to change here before merging?

Copy link
Contributor

@klauer klauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍 Admittedly I haven't run it to try it out though!

Hope our comments were useful tips on writing a bit better bash scripts

@ZLLentz ZLLentz merged commit 6f84079 into pcdshub:master Mar 1, 2023
@wnwright
Copy link
Contributor Author

wnwright commented Mar 1, 2023

Thanks @ZLLentz and @klauer !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants