create an UNDO_REQUIREMENTS variable

in the gate, we actually need to *not* roll back the requirements,
otherwise tempest can wedge the world because it runs under tox.

Make a variable that we can set to false in the gate to ensure that
we don't roll back the requirements changes.

Change-Id: I2b842ecc3f6e8b917dd721729640000bd7e7fb78
diff --git a/functions b/functions
index c707e55..bece5a4 100644
--- a/functions
+++ b/functions
@@ -1257,9 +1257,18 @@
     # ensure that further actions can do things like setup.py sdist
     safe_chown -R $STACK_USER $1/*.egg-info
 
-    # Undo requirements changes, if we made them
-    if [ $update_requirements -eq 0 ]; then
-         (cd $project_dir && git reset --hard)
+    # We've just gone and possibly modified the user's source tree in an
+    # automated way, which is considered bad form if it's a development
+    # tree because we've screwed up their next git checkin. So undo it.
+    #
+    # However... there are some circumstances, like running in the gate
+    # where we really really want the overridden version to stick. So provide
+    # a variable that tells us whether or not we should UNDO the requirements
+    # changes (this will be set to False in the OpenStack ci gate)
+    if [ $UNDO_REQUIREMENTS = "True"]; then
+        if [ $update_requirements -eq 0 ]; then
+            (cd $project_dir && git reset --hard)
+        fi
     fi
 }