imported patch fix-clientpy
authorKai Engert <kaie@kuix.de>
Wed, 20 Sep 2017 16:09:14 +0200
changeset 1299025 f145cc4fb4b63536779eb0fabc982e934191b4cf
parent 1298979 0c49ebf4195ce51072b24aacf01eaaffdcff9be6
child 1299026 f1f2a8f4c9d1b9e5bb5fc8b74d4327c7f6528418
push id222719
push userkaie@kuix.de
push dateWed, 20 Sep 2017 14:33:37 +0000
treeherdertry@d38c24961996 [default view] [failures only]
milestone57.0a1
imported patch fix-clientpy
client.py
--- a/client.py
+++ b/client.py
@@ -107,32 +107,34 @@ def update_nspr_or_nss(tag, depfile, des
   destination = destination.rstrip('/')
   permanent_patch_dir = destination + '/patches'
   temporary_patch_dir = destination + '.patches'
   if os.path.exists(temporary_patch_dir):
     print "please clean up leftover directory " + temporary_patch_dir
     sys.exit(2)
   warn_if_patch_exists(permanent_patch_dir)
   # protect patch directory from being removed by do_hg_replace
-  shutil.move(permanent_patch_dir, temporary_patch_dir)
+  if os.path.exists(permanent_patch_dir):
+    shutil.move(permanent_patch_dir, temporary_patch_dir)
   # now update the destination
   print "reverting to HG version of %s to get its blank line state" % depfile
   check_call_noisy([options.hg, 'revert', depfile])
   old_state = get_trailing_blank_line_state(depfile)
   print "old state of %s is: %s" % (depfile, old_state)
   do_hg_replace(destination, hgpath, tag, HG_EXCLUSIONS, options.hg)
   new_state = get_trailing_blank_line_state(depfile)
   print "new state of %s is: %s" % (depfile, new_state)
   if old_state == new_state:
     print "toggling blank line in: ", depfile
     toggle_trailing_blank_line(depfile)
   tag_file = destination + "/TAG-INFO"
   print >>file(tag_file, "w"), tag
   # move patch directory back to a subdirectory
-  shutil.move(temporary_patch_dir, permanent_patch_dir)
+  if os.path.exists(permanent_patch_dir):
+    shutil.move(temporary_patch_dir, permanent_patch_dir)
 
 def warn_if_patch_exists(path):
   # If the given patch directory exists and contains at least one file,
   # then print warning and wait for the user to acknowledge.
   if os.path.isdir(path) and os.listdir(path):
     print "========================================"
     print "WARNING: At least one patch file exists"
     print "in directory: " + path