Skip to content

Modify update command to directly edit the mbed-os.lib files for each example #3528

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

Merged
merged 2 commits into from
Jan 12, 2017

Conversation

adbridge
Copy link
Contributor

@adbridge adbridge commented Jan 5, 2017

as specified in the supplied .json file, in a user specified fork.
A pull request is then made from each fork to the ARMmbed master repo.

New usage:
python update.py
Where are:
[-c <file.json>] optional argument for example list, default
example.json
-U
-T
tag

example specified in the supplied .json file, in a user specified fork.
A pull request is then made from each fork to the ARMmbed master repo.

New usage:
python update.py <args>
Where <args> are:
  [-c <file.json>] optional argument for example list, default
                   example.json
  -U <github user with forked repos>
  -T <github authorisation token>
  tag
@adbridge
Copy link
Contributor Author

adbridge commented Jan 5, 2017

@bridadan please review.

cmd = ['git', 'push', '-f', 'origin']
return_code = run_cmd(cmd)
if not return_code:
ret = True
Copy link
Contributor

@theotherjimmy theotherjimmy Jan 5, 2017

Choose a reason for hiding this comment

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

Wow. Is this really the best way to do this? Maybe:

for cmd in [['git', 'remote', 'add', 'armmbed', arm_example],
            ['git', 'fetch', 'armmbed'],
            ['git', 'reset', '--hard', 'armmbed/master'],
            ['git', 'push', '-f', 'origin']]:
    if run_cmd(cmd):
        print("preparation of the fork failed!")
        return False
return True

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah that looks better :)

Copy link
Contributor

@bridadan bridadan left a comment

Choose a reason for hiding this comment

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

Just a few nits, please see below

print("Ignoring and moving on to the next example")
os.chdir(cwd)
if os.path.isfile("mbed-os.lib"):
os.system("mv mbed-os.lib mbed-os.lib_bak")
Copy link
Contributor

Choose a reason for hiding this comment

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

mv is not a valid command on Windows, can you use os.rename instead please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will update

"This usually inidicates that no update was made. Still " + \
"attempting to create a tag.")
if not return_code:
body = "Please test/merge this PR and then tag Master with " + tag
Copy link
Contributor

Choose a reason for hiding this comment

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

Yay for bots! 😄 🤖

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Until all the example owners have automatic testing of their examples for each PR, then they need the prompt!

In prepare_fork(), change nested IF to neat command loop.
@adbridge
Copy link
Contributor Author

adbridge commented Jan 9, 2017

@bridadan @theotherjimmy review comments added and retested locally. Please re-review.

Copy link
Contributor

@bridadan bridadan left a comment

Choose a reason for hiding this comment

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

LGTM

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

Successfully merging this pull request may close these issues.

4 participants