-
-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mercurial command server #459
base: master
Are you sure you want to change the base?
Conversation
Otherwise it won't work on Windows currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of idiomatic suggestions.
src/resolvers/hg.cr
Outdated
|
||
protected def versions_from_tags | ||
capture_hg("tags", "--template", "{tag}\\n") | ||
.split('\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.split('\n') | |
.lines |
src/resolvers/hg.cr
Outdated
return HgTagRef.new value | ||
when "commit" | ||
return HgCommitRef.new value | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else |
src/resolvers/hg.cr
Outdated
source = hg_url | ||
# Remove a "file://" from the beginning, otherwise the path might be invalid | ||
# on Windows. | ||
source = source[7..] if source.starts_with?("file://") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source = source[7..] if source.starts_with?("file://") | |
source = source.lchop("file://") |
src/resolvers/hg.cr
Outdated
yield | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yield | |
break | |
return yield |
src/resolvers/hg.cr
Outdated
|
||
private def valid_repository? | ||
File.each_line(File.join(local_path, ".hg", "dirstate")) do |line| | ||
return true if line =~ /mirror\s*=\s*true/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return true if line =~ /mirror\s*=\s*true/ | |
return true if line.matches?(/mirror\s*=\s*true/) |
Please let's focus on #458 first and revisit this once that is merged. |
…exist Exceptions should only be used on real errors, not on expected fails.
#458 has been merged, so we can move forward with this. Sorry for the slow review process 🙇♂️ |
This is a modification of the HgResolver from some other pull request to make use of the hg command server to speed up hg commands.
The mercurial command server is feature of hg to overcome the (relatively long) startup time of the Python interpreter. Instead of starting a new interpreter for each single hg command only a single process is started. All subsequent hg commands are then passed to this running process.
The command server is started by
HgResolver
the first time a command is run. The same command server is also used for all test cases.This overall reduces the running time of all hg tests to a few seconds.