Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/docs/bin/generate_docs.py

Issue 29335805: Issue 1299 - Generate docs outside the devbuild build process (Closed)
Patch Set: Use hg clone/pull instead of hg archive Created Feb. 8, 2016, 9:57 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
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: sitescripts/docs/bin/generate_docs.py
===================================================================
--- a/sitescripts/docs/bin/generate_docs.py
+++ b/sitescripts/docs/bin/generate_docs.py
@@ -34,30 +34,13 @@
return projects
def sync_sources(sources_dir, repository_url):
- remote_id = subprocess.check_output(["hg", "id", "--id", repository_url])
- id_path = sources_dir.rstrip(os.path.sep) + ".id"
- try:
- with open(id_path, "rb") as id_file:
- local_id = id_file.read()
- if local_id == remote_id:
- return
- except IOError:
- pass
-
- shutil.rmtree(sources_dir, ignore_errors=True)
- subprocess.check_call(["hg", "archive",
- "--repository", repository_url,
- "--rev", "master",
- sources_dir])
-
- # In theory, it is possible that some changesets are pushed after we fetch
- # the ID above, but before we run `hg archive`, which will lead to an
- # unnecessary `hg archive` operation the next time this runs.
- with open(id_path, "wb") as id_file:
- id_file.write(remote_id)
-
- # This is a workaround for https://issues.adblockplus.org/ticket/3635.
- os.makedirs(os.path.join(sources_dir, ".hg"))
+ if os.path.exists(sources_dir):
+ subprocess.check_call(["hg", "pull", "--quiet", "--update"
+ "--repository", sources_dir])
Wladimir Palant 2016/02/09 10:44:28 You don't really want to call |hg pull --update|,
Felix Dahlke 2016/02/09 12:40:22 Done.
+ else:
+ subprocess.check_call(["hg", "clone", "--quiet",
+ "--updaterev", "master",
+ repository_url, sources_dir])
def replace_dir(source_dir, target_dir):
if not os.path.exists(target_dir):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld