Prune remote branches when mirroring.

* jeepyb/cmd/run_mirror.py: Use git fetch -p origin so deleted
remote branches will be removed locally before processing. Also deal
with pip freeze warnings which might include "==" by skipping lines
containing spaces when looking for package versions to download, and
make sure to match "-e" lines as well.

Change-Id: I646ce937b59da211d03ae2d3b09c9aabd10cb91e
Reviewed-on: https://review.openstack.org/23494
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
diff --git a/jeepyb/cmd/run_mirror.py b/jeepyb/cmd/run_mirror.py
index 73b18bb..9a21dd0 100644
--- a/jeepyb/cmd/run_mirror.py
+++ b/jeepyb/cmd/run_mirror.py
@@ -101,7 +101,7 @@
             if DEBUG:
                 print(out)
         os.chdir(short_project)
-        out = run_command("git fetch origin")
+        out = run_command("git fetch -p origin")
         if DEBUG:
             print(out)
 
@@ -140,7 +140,8 @@
                     freeze = run_command("%s freeze -l" % pip)
                     reqfd = open(reqs, "w")
                     for line in freeze.split("\n"):
-                        if "==" in line:
+                        if line.startswith("-e ") or (
+                                "==" in line and " " not in line):
                             reqfd.write(line + "\n")
                     reqfd.close()
                     out = run_command(venv_format % (PIP_DOWNLOAD_CACHE, venv))