Merge "sync: Add option '--force-remove-dirty'"
diff --git a/docs/python-support.md b/docs/python-support.md
new file mode 100644
index 0000000..af19cd0
--- /dev/null
+++ b/docs/python-support.md
@@ -0,0 +1,32 @@
+# Supported Python Versions
+
+With Python 2.7 officially going EOL on [01 Jan 2020](https://pythonclock.org/),
+we need a support plan for the repo project itself.
+Inevitably, there will be a long tail of users who still want to use Python 2 on
+their old LTS/corp systems and have little power to change the system.
+
+## Summary
+
+* Python 3.6 (released Dec 2016) is required by default starting with repo-1.14.
+* Older versions of Python (e.g. v2.7) may use the legacy feature-frozen branch
+  based on repo-1.13.
+
+## Overview
+
+We provide a branch for Python 2 users that is feature-frozen.
+Bugfixes may be added on a best-effort basis or from the community, but largely
+no new features will be added, nor is support guaranteed.
+
+Users can select this during `repo init` time via the [repo launcher].
+Otherwise the default branches (e.g. stable & master) will be used which will
+require Python 3.
+
+This means the [repo launcher] needs to support both Python 2 & Python 3, but
+since it doesn't import any other repo code, this shouldn't be too problematic.
+
+The master branch will require Python 3.6 at a minimum.
+If the system has an older version of Python 3, then users will have to select
+the legacy Python 2 branch instead.
+
+
+[repo launcher]: ../repo
diff --git a/event_log.py b/event_log.py
index 508b18e..0696df5 100644
--- a/event_log.py
+++ b/event_log.py
@@ -51,7 +51,6 @@
   def __init__(self):
     """Initializes the event log."""
     self._log = []
-    self._next_id = _EventIdGenerator()
     self._parent = None
 
   def Add(self, name, task_name, start, finish=None, success=None,
@@ -71,7 +70,7 @@
       A dictionary of the event added to the log.
     """
     event = {
-        'id': (kind, next(self._next_id)),
+        'id': (kind, _NextEventId()),
         'name': name,
         'task_name': task_name,
         'start_time': start,
@@ -162,16 +161,16 @@
         f.write('\n')
 
 
-def _EventIdGenerator():
-  """Returns multi-process safe iterator that generates locally unique id.
+# An integer id that is unique across this invocation of the program.
+_EVENT_ID = multiprocessing.Value('i', 1)
 
-  Yields:
+def _NextEventId():
+  """Helper function for grabbing the next unique id.
+
+  Returns:
     A unique, to this invocation of the program, integer id.
   """
-  eid = multiprocessing.Value('i', 1)
-
-  while True:
-    with eid.get_lock():
-      val = eid.value
-      eid.value += 1
-    yield val
+  with _EVENT_ID.get_lock():
+    val = _EVENT_ID.value
+    _EVENT_ID.value += 1
+  return val