-
Notifications
You must be signed in to change notification settings - Fork 26
Hands-on: Fetch and merge from a remote #99
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
base: main
Are you sure you want to change the base?
Conversation
woojiahao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some minor nits about coding convention!
hands_on/fetch_merge.py
Outdated
| from exercise_utils.gitmastery import create_start_tag | ||
|
|
||
| __requires_git__ = True | ||
| __requires_github__ = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're not using gh, you don't need this to be set to true
| __requires_github__ = True | |
| __requires_github__ = False |
hands_on/fetch_merge.py
Outdated
|
|
||
| def download(verbose: bool): | ||
| os.makedirs("samplerepo-finances") | ||
| # Clone the samplerepo-finances repo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Clone the samplerepo-finances repo |
hands_on/fetch_merge.py
Outdated
| # Clone the samplerepo-finances repo | ||
| run_command(["git", "clone", "https://github.com/git-mastery/samplerepo-finances.git"], verbose) | ||
| os.chdir("samplerepo-finances") | ||
| # Change the remote origin to point to samplerepo-finances-2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Change the remote origin to point to samplerepo-finances-2 |
hands_on/fetch_merge.py
Outdated
|
|
||
| pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| pass |
once the function behavior is populated, you are free to remove pass
|
@woojiahao understood, implemented suggested changes in latest commit. |
woojiahao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left comments
hands_on/fetch_merge.py
Outdated
| os.makedirs("samplerepo-finances") | ||
| run_command(["git", "clone", "https://github.com/git-mastery/samplerepo-finances.git"], verbose) | ||
| os.chdir("samplerepo-finances") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this set of steps are necessary. If you run clone_repo_with_git, it should produce the folder you need.
| os.makedirs("samplerepo-finances") | |
| run_command(["git", "clone", "https://github.com/git-mastery/samplerepo-finances.git"], verbose) | |
| os.chdir("samplerepo-finances") | |
| clone_repo_with_git("https://github.com/git-mastery/samplerepo-finances.git", verbose) | |
| os.chdir("samplerepo-finances") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed, new version uses clone_repo_with_git function.
hands_on/fetch_merge.py
Outdated
| os.makedirs("samplerepo-finances") | ||
| run_command(["git", "clone", "https://github.com/git-mastery/samplerepo-finances.git"], verbose) | ||
| os.chdir("samplerepo-finances") | ||
| run_command(["git", "remote", "set-url", "origin", "https://github.com/git-mastery/samplerepo-finances-2.git"], verbose) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was not able to recreate the output in https://nus-cs2103-ay2526s1.github.io/website/book/gitAndGithub/pull/ exactly using add_remote and remove remote. Falling back to run_command instead.
|
Hi @LeeZeHao, is this PR currently being worked on? Would be good to get an update by 9 Dec, else we need to close this PR, so that we can resolve this issue. Thanks! |
|
@jovnc @woojiahao I have made the latest commits. |
| "https://github.com/git-mastery/samplerepo-finances.git", verbose | ||
| ) | ||
| os.chdir("samplerepo-finances") | ||
| run_command( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use this instead from exercise_utils.git
remove_remote("origin", verbose)
add_remote("origin", "https://github.com/git-mastery/samplerepo-finances-2", verbose)
This is equivalent to a set-url. Alternatively, you can create a new utility to do this under exercise-utils but that may be unnecessary.
This is a similar merged PR #116
Exercise Review
Exercise Discussion
#86
Checklist
Git-Masteryorganization, have you created a request for it?repo-smithto validate the exercise grading scheme?test-download.sh?git-autograder?app?