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): |