pytorch
f1e72a7e - add uncommit change detector (#54373)

Commit
3 years ago
add uncommit change detector (#54373) Summary: warn if uncommit changes exists in .circleci/config.yml, unlike other generated code, .circleci/config.yml actually commits to the repo. (this is a follow up of https://github.com/pytorch/pytorch/issues/54345) two options I am open to 1. abort regenerate if detected 2. print out backed up temp filename Also remove the `-x` since it is currently very verbose ``` ++ dirname .circleci/regenerate.sh + cd .circleci ++ mktemp + OLD_FILE=/var/folders/vw/ryb6j4d97xs1t_14024b710h0000gn/T/tmp.54GhUh7w + cp config.yml /var/folders/vw/ryb6j4d97xs1t_14024b710h0000gn/T/tmp.54GhUh7w ++ mktemp + NEW_FILE=/var/folders/vw/ryb6j4d97xs1t_14024b710h0000gn/T/tmp.aV87RTvQ + ./generate_config_yml.py + cp /var/folders/vw/ryb6j4d97xs1t_14024b710h0000gn/T/tmp.aV87RTvQ config.yml ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/54373 Test Plan: 1. ``` $ echo "418 I'm a teapot" > .circleci/config.yml $ .circleci/regenerate.sh $ .circleci/regenerate.sh ``` Result: ``` $ .circleci/regenerate.sh Uncommitted change detected in .circleci/config.yml It has been backed up to /var/folders/89/brnr1wt970130lk0m52605mw0000gn/T/tmp.2VOp4BPo New config generated in .circleci/config.yml $ .circleci/regenerate.sh #-- second time there's no uncommitted changes New config generated in .circleci/config.yml ``` 2. ``` $ echo "418 I'm a teapot" > .circleci/config.yml $ git add .circleci/config.yml $ .circleci/regenerate.sh $ .circleci/regenerate.sh ``` Result: ``` $ .circleci/regenerate.sh Uncommitted change detected in .circleci/config.yml It has been backed up to /var/folders/89/brnr1wt970130lk0m52605mw0000gn/T/tmp.2VOp4BPo New config generated in .circleci/config.yml $ .circleci/regenerate.sh #-- second time there's still uncommitted changes b/c git split staged vs unstaged changes Uncommitted change detected in .circleci/config.yml It has been backed up to /var/folders/89/brnr1wt970130lk0m52605mw0000gn/T/tmp.2ruMAynI New config generated in .circleci/config.yml ``` Reviewed By: samestep Differential Revision: D27234394 Pulled By: walterddr fbshipit-source-id: 6364cc1f6f71a43424a63ca6fce9d2ba69437741
Author
Rong Rong (AI Infra)
Parents
Loading