Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-pipeline
Commits
8b570fa2
Commit
8b570fa2
authored
Apr 17, 2011
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move hexdigest out of utils
parent
4efbc491
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
15 deletions
+8
-15
compress/utils.py
+0
-12
compress/versioning/git/__init__.py
+8
-3
No files found.
compress/utils.py
View file @
8b570fa2
...
...
@@ -35,18 +35,6 @@ def get_mod_func(callback):
return
callback
[:
dot
],
callback
[
dot
+
1
:]
def
get_hexdigest
(
plaintext
):
"""
Create a hexdigest from a plaintext string
"""
try
:
import
hashlib
return
hashlib
.
sha1
(
plaintext
)
.
hexdigest
()
except
ImportError
:
import
sha
return
sha
.
new
(
plaintext
)
.
hexdigest
()
def
needs_update
(
output_file
,
source_files
,
verbosity
=
0
):
"""
Scan the source files for changes and returns True if the output_file needs to be updated.
...
...
compress/versioning/git/__init__.py
View file @
8b570fa2
from
compress.conf
import
settings
from
compress.utils
import
get_output_filename
,
get_hexdigest
,
compress_source
from
compress.utils
import
get_output_filename
,
compress_source
from
compress.versioning
import
VersioningBase
,
VersioningError
from
django.utils.hashcompat
import
sha_constructor
try
:
import
git
except
ImportError
:
...
...
@@ -21,6 +23,9 @@ class GitVersioningBase(VersioningBase):
# no placeholder found, do not update, manual update if needed
return
False
,
version
def
hexdigest
(
self
,
plaintext
):
return
sha_constructor
(
plaintext
)
.
hexdigest
()
class
GitRevVersioning
(
GitVersioningBase
):
"""
...
...
@@ -33,7 +38,7 @@ class GitRevVersioning(GitVersioningBase):
for
f
in
source_files
:
commit
=
[
i
for
i
in
repo
.
iter_commits
(
paths
=
compress_source
(
f
),
**
kwargs
)][
0
]
commit_revs
.
append
(
commit
.
name_rev
)
return
get_
hexdigest
(
', '
.
join
(
commit_revs
))[
0
:
16
]
return
self
.
hexdigest
(
', '
.
join
(
commit_revs
))[
0
:
16
]
class
GitHeadRevVersioning
(
GitVersioningBase
):
...
...
@@ -43,4 +48,4 @@ class GitHeadRevVersioning(GitVersioningBase):
def
get_version
(
self
,
source_files
):
f
=
source_files
[
0
]
repo
=
git
.
Repo
(
compress_source
(
f
))
return
get_
hexdigest
(
repo
.
head
.
commit
.
name_rev
)[
0
:
16
]
return
self
.
hexdigest
(
repo
.
head
.
commit
.
name_rev
)[
0
:
16
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment