No longer rely on external service for LFS tracking #18

Merged
Ghost merged 2 commits from add_lfs into main 2022-11-08 11:00:34 +01:00
First-time contributor
No description provided.
Ghost added 2 commits 2022-11-07 21:52:15 +01:00
The calculation of the sha256 and the mimetype is local due to that
Author
First-time contributor

And yes, the class name is strange now.

And yes, the class name is strange now.
aplanas reviewed 2022-11-08 09:51:37 +01:00
@ -0,0 +17,4 @@
return h.hexdigest()
md5 = functools.partial(_hash, hashlib.md5)
Owner

Do not remove the sha256, can be used during the download call (without storing the file). Note that you reimplemented it later with a similiar for

Do not remove the sha256, can be used during the download call (without storing the file). Note that you reimplemented it later with a similiar `for`
Ghost marked this conversation as resolved
@ -96,0 +51,4 @@
logging.debug(f"Add LFS for {project}/{package}/{name}")
fin = self.obs._download(project, package, name, revision)
sha = hashlib.sha256()
while True:
Owner

Here. This should be dropped.

Here. This should be dropped.
Ghost marked this conversation as resolved
@ -96,0 +57,4 @@
break
sha.update(buffer)
# only guess from the first 10K
if not mimetype:
Owner

ah ok, you use the loop for this, imho it is ok to move it out

ah ok, you use the loop for this, imho it is ok to move it out
Author
First-time contributor

Are you talking to yourself? 😄

What's the outcome?

Are you talking to yourself? 😄 What's the outcome?
Owner

IMHO do not mix both. Keep sha256 as a partial function, like the md5. This will work on the download-file-a-like handler.

The mime-type can be keep here (keeping an additional read), or moved into some place that consolidate stuff that answer all the questions about "is this a text file, is this a big file, what is the mime-type of this file, ..."

IMHO do not mix both. Keep sha256 as a partial function, like the md5. This will work on the download-file-a-like handler. The mime-type can be keep here (keeping an additional read), or moved into some place that consolidate stuff that answer all the questions about "is this a text file, is this a big file, what is the mime-type of this file, ..."
Author
First-time contributor

I won't download the file twice, no.

I won't download the file twice, no.
Ghost marked this conversation as resolved
Ghost merged commit f5b29886ae into main 2022-11-08 11:00:34 +01:00
Ghost deleted branch add_lfs 2022-11-08 11:00:38 +01:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: importers/git-importer#18
No description provided.