Skip to content

Commit

Permalink
Revert "Make HG pull faster by not cloning when not necessary"
Browse files Browse the repository at this point in the history
This reverts commit c6d5991.
  • Loading branch information
mathjazz committed Mar 9, 2017
1 parent 3356ab4 commit 85fb26b
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions pontoon/sync/vcs/repositories.py
Expand Up @@ -71,33 +71,15 @@ def pull(self, source=None, target=None, branch=None):
class PullFromHg(PullFromRepository):

def pull(self, source=None, target=None):
log.debug("Mercurial: Update repository.")

source = source or self.source
target = target or self.target

if os.path.exists(target):
log.debug("Mercurial: Update repository.")

# Undo local changes: discard uncommitted changes
command = ["hg", "update", "--clean"]
execute(command, target)

# Undo local changes: delete untracked files
command = ["hg", "--config", "extensions.strip=", "purge"]
execute(command, target)

# Undo local changes: discard local commits
command = ["hg", "--config", "extensions.strip=", "strip", "'roots(draft())'"]
execute(command, target)

command = ["hg", "pull", "-u"]
code, output, error = execute(command, target)

if code == 0:
return log.debug("Mercurial: Repository at " + source + " updated.")
else:
log.info("Mercurial: " + unicode(error))
# Undo local changes: Mercurial doesn't offer anything more elegant
command = ["rm", "-rf", target]
code, output, error = execute(command)

log.debug("Mercurial: Clone repository.")
command = ["hg", "clone", source, target]
code, output, error = execute(command)

Expand Down

1 comment on commit 85fb26b

@mathjazz
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't bring any speedups. In fact, it seems sync was even slower. It also introduced an issue where two projects for one locale filed to sync due to commit error: abort: push creates new remote head.

We should investigate this, but it's not a high priority.

Please sign in to comment.