Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: tools/dom/scripts/idlsync.py

Issue 13162002: Save all version control dirs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/idlsync.py
diff --git a/tools/dom/scripts/idlsync.py b/tools/dom/scripts/idlsync.py
index b2589080f25fd64da13b5f0bc9e3f8527c6648da..43c88d7248544b11263d59eb6d63ff346eea8da9 100755
--- a/tools/dom/scripts/idlsync.py
+++ b/tools/dom/scripts/idlsync.py
@@ -177,26 +177,19 @@ def GenerateReadme(local_path, template, url, revision):
out.write(readme)
out.close()
+ZIP_ARCHIVE = 'version-control-dirs.zip'
+
def SaveVersionControlDir(local_path):
- version_control_dir = os.path.join(local_path, '.git')
- if not os.path.isdir(version_control_dir):
- version_control_dir = os.path.join(local_path, '.svn')
- if not os.path.isdir(version_control_dir):
- raise '%s is not a git or svn directory' % local_path
- temp_dir = tempfile.mkdtemp()
- shutil.move(version_control_dir, temp_dir)
- return temp_dir
-
-
-def RestoreVersionControlDir(local_path, saved_version_control_dir):
- version_control_dir = os.path.join(saved_version_control_dir, '.git')
- if not os.path.isdir(version_control_dir):
- version_control_dir = os.path.join(saved_version_control_dir, '.svn')
- if not os.path.isdir(version_control_dir):
- raise 'Failed restoring version control directory'
- shutil.move(version_control_dir, local_path)
- shutil.rmtree(saved_version_control_dir)
+ RunCommand([
+ 'sh', '-c',
+ 'find %s -name .svn -or -name .git | zip -r %s -@' % (
+ os.path.relpath(local_path), ZIP_ARCHIVE)
+ ])
+
+def RestoreVersionControlDir():
+ RunCommand(['unzip', ZIP_ARCHIVE, '-d', '.'])
+ RunCommand(['rm', ZIP_ARCHIVE])
def ParseOptions():
parser = optparse.OptionParser()
@@ -225,11 +218,11 @@ def main():
url, latest = GetSvnRevision(deps, component)
if revision is None:
revision = latest
- saved_version_control_dir = SaveVersionControlDir(local_path);
+ SaveVersionControlDir(local_path);
RefreshFiles(url, revision, remote_path, local_path, depth)
PruneExtraFiles(local_path)
GenerateReadme(local_path, readme, url, revision)
- RestoreVersionControlDir(local_path, saved_version_control_dir);
+ RestoreVersionControlDir();
if __name__ == '__main__':
main()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698