Skip to content
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

Override VCSDownloadStrategy#source_modified_time #171

Closed

Conversation

vladshablinsky
Copy link
Contributor

@vladshablinsky vladshablinsky commented Apr 30, 2016

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully ran brew tests with your changes locally?

Detaills

Implement

  • MercurialDownloadStrategy#source_modified_time
  • BazaarDownloadStrategy#source_modified_time
  • FossilDownloadStrategy#source_modified_time

from #81

Bazaar

bzr log -l 1 has the following format:

➜ vlad:bazimport$ bzr log -l 1
------------------------------------------------------------
revno: 663
committer: Aaron Bentley <aaron@aaronbentley.com>
branch nick: bazimport
timestamp: Thu 2008-10-23 18:04:00 +0100
message:
  Fix import with existing revisions

Mercurial

hg tip has the following format:

➜ vlad:SDL_rtf$ hg tip
changeset:   66:c0f87ece5d47
tag:         tip
user:        Sam Lantinga <slouken@libsdl.org>
date:        Sat Jan 02 10:54:19 2016 -0800
summary:     Updated copyright to 2016

hg log -l 1 also possible, but hg tip seems to be better.

Fossil

fossil info tip -R <repo> has the following format:

➜ vlad:fossil$ fossil info tip -R fossil
uuid:         7c4628a568c01a11642e18c119c93aa1d85632ed 2016-04-29 10:28:21 UTC
parent:       6f35075ad72b8608bd5ce2fccf093495331d1187 2016-04-29 08:28:27 UTC
tags:         trunk
comment:      Make options --repolist and --baseurl work together, if the original URL doesn't end with '/'. (user: jan.nijtmans)

@MikeMcQuaid
Copy link
Member

LGTM 👍 @xu-cheng?

@UniqMartin
Copy link
Contributor

Not being very familiar with the listed tools, is there some way to make them output the time in a more standardized way (e.g. ISO 8601, RFC 2822) like we do with the Git download strategy? It would be a pity if parsing failed because of version-dependent changes in the human-readable output format that is currently being parsed or if the time format adapts to the user's locale. Have you checked what happens when you set, e.g., LC_ALL=de_DE.UTF-8 prior to invocation?

@vladshablinsky
Copy link
Contributor Author

vladshablinsky commented May 1, 2016

@UniqMartin I modified the options a little, I guess this is all I can do here. It'll output dates in UTC format, but I cannot manage to output it in a more standartised way. Time.parse can interpret almost everything given to it, though, so the change is not very big.

Have you checked what happens when you set, e.g., LC_ALL=de_DE.UTF-8 prior to invocation?

Doesn't change anything.

@@ -830,6 +838,10 @@ def stage
safe_system(*args)
end

def source_modified_time
Time.parse Utils.popen_read("fossil", "info", "tip", "-R", cached_location.to_s)[/^parent: *\h* (.*)$/, 1]
Copy link
Contributor

Choose a reason for hiding this comment

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

  • I think it would be good to make the pattern ^parent: +\h+ (.+)$ instead of ^parent: *\h* (.*)$. Judging from the example output it seems reasonable to expect that there is always whitespace after the colon, always a hexadecimal ID, and always a non-empty date/time.
  • Looking at the example output you provided makes me think we should be parsing the uuid: line instead of the parent: line. I tried to confirm that by searching Fossil's online documentation, but failed to find a definitive answer. Can you check that and/or point me at the relevant documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@UniqMartin agree on regex.

Thanks a lot about parent and uuid stuff, I can't explain why I wrote parent instead of uuid. It's something wrong with me.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's something wrong with me.

There's nothing wrong with you! That's just human and happens to all of us all the time. 😸

@UniqMartin
Copy link
Contributor

I modified the options a little, I guess this is all I can do here. It'll output dates in UTC format, but I cannot manage to output it in a more standartised way. Time.parse can interpret almost everything given to it, though, so the change is not very big.

Thanks for checking and adjusting your code where necessary!

Doesn't change anything.

Great! That's reassuring.

@UniqMartin
Copy link
Contributor

👍 Looks good to me; also all of my comments have been addressed.

@xu-cheng xu-cheng closed this in 6f1116c May 1, 2016
@xu-cheng
Copy link
Member

xu-cheng commented May 1, 2016

Thanks everyone.

@UniqMartin UniqMartin added the gsoc-outreachy Google Summer of Code or Outreachy label Jun 22, 2016
@vladshablinsky vladshablinsky deleted the source_modified_time branch September 22, 2016 11:38
@Homebrew Homebrew locked and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
gsoc-outreachy Google Summer of Code or Outreachy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants