Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
clpm
clpm
Commits
5a0c79ab
Commit
5a0c79ab
authored
Feb 19, 2020
by
Eric Timmons
Browse files
Make repo fetching respect local flag on bundle commands
parent
abbb9ad0
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/clpm/bundle.lisp
View file @
5a0c79ab
...
...
@@ -11,6 +11,7 @@
#:clpm/context
#:clpm/install
#:clpm/log
#:clpm/repos
#:clpm/resolve
#:clpm/source
)
(
:export
#:bundle-install
...
...
@@ -51,7 +52,8 @@
(
defun
bundle-install
(
clpmfile-designator
&key
localp
(
validate
(
constantly
t
)))
"Given a clpmfile instance, install all releases from its lock file, creating
the lock file if necessary."
(
let*
((
clpmfile
(
get-clpmfile
clpmfile-designator
))
(
let*
((
*fetch-repo-automatically*
(
not
localp
))
(
clpmfile
(
get-clpmfile
clpmfile-designator
))
(
lockfile-pathname
(
clpmfile-lockfile-pathname
clpmfile
))
(
lockfile
nil
)
(
changedp
nil
))
...
...
@@ -75,7 +77,8 @@ the lock file if necessary."
update-projects
(
validate
(
constantly
t
))
update-systems
localp
)
(
let*
((
clpmfile
(
get-clpmfile
clpmfile-designator
))
(
let*
((
*fetch-repo-automatically*
(
not
localp
))
(
clpmfile
(
get-clpmfile
clpmfile-designator
))
(
lockfile-pathname
(
clpmfile-lockfile-pathname
clpmfile
))
(
lockfile
nil
)
(
changedp
nil
))
...
...
src/clpm/repos/defs.lisp
View file @
5a0c79ab
...
...
@@ -6,7 +6,8 @@
(
uiop:define-package
#:clpm/repos/defs
(
:use
#:cl
)
(
:export
#:ensure-ref-present-locally!
(
:export
#:*fetch-repo-automatically*
#:ensure-ref-present-locally!
#:ref-present-p
#:repo-archive-stream
#:repo-lib-base-pathname
...
...
@@ -15,6 +16,8 @@
(
in-package
#:clpm/repos/defs
)
(
defvar
*fetch-repo-automatically*
t
)
(
defgeneric
ensure-ref-present-locally!
(
repo
ref
))
(
defgeneric
ref-present-p
(
repo
ref
))
...
...
src/clpm/repos/git.lisp
View file @
5a0c79ab
...
...
@@ -218,22 +218,28 @@ ref is present locally, fetching or cloning the repo as necessary."
(
destructuring-bind
(
ref-type
ref-name
)
ref
(
declare
(
ignore
ref-name
))
(
let
((
local-dir
(
git-repo-local-dir
repo
)))
(
if
(
uiop:probe-file*
local-dir
)
;; Repo is present, need to fetch if the ref is not present or the ref
;; is a branch.
(
when
(
or
(
eql
ref-type
:branch
)
(
not
(
ref-present-p
repo
ref
)))
(
with-retries
(
:max
10
:sleep
5
)
(
fetch-repo!
repo
))
;; Make sure the ref is actually present, raising an error otherwise.
(
unless
(
ref-present-p
repo
ref
)
(
error
"ref is not present, even after updating."
)))
;; Repo is not present at all, need to clone it.
(
with-retries
(
:max
10
:sleep
5
)
(
clone-repo!
repo
)
;; Make sure the ref is actually present, raising an error otherwise.
(
unless
(
ref-present-p
repo
ref
)
(
error
"ref is not present, even after updating."
)))))))
(
cond
((
uiop:probe-file*
local-dir
)
;; Repo is present, need to fetch if the ref is not present or the ref
;; is a branch.
(
when
(
and
(
or
(
eql
ref-type
:branch
)
(
not
(
ref-present-p
repo
ref
)))
*fetch-repo-automatically*
)
(
with-retries
(
:max
10
:sleep
5
)
(
fetch-repo!
repo
))
;; Make sure the ref is actually present, raising an error otherwise.
(
unless
(
ref-present-p
repo
ref
)
(
error
"ref ~S is not present"
ref
))))
(
*fetch-repo-automatically*
;; Repo is not present at all, need to clone it.
(
with-retries
(
:max
10
:sleep
5
)
(
clone-repo!
repo
)
;; Make sure the ref is actually present, raising an error otherwise.
(
unless
(
ref-present-p
repo
ref
)
(
error
"ref is not present, even after updating."
))))
(
t
;; Repo is not present and we were told to not fetch it. Error.
(
error
"Repo is not present at ~A"
local-dir
))))))
(
defmethod
repo-archive-stream
((
repo
git-repo
)
ref
)
(
values
...
...
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