Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UNL-CMS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eric Rasmussen
UNL-CMS
Commits
4b28bcca
Commit
4b28bcca
authored
12 years ago
by
Eric Rasmussen
Browse files
Options
Downloads
Patches
Plain Diff
[gh-631] Working clone and pull with Run operation
parent
74faafd7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
sites/all/modules/git_include/git_include.module
+16
-5
16 additions, 5 deletions
sites/all/modules/git_include/git_include.module
sites/all/modules/git_include/plugins/export_ui/git_include_export_ui.class.php
+2
-0
2 additions, 0 deletions
...include/plugins/export_ui/git_include_export_ui.class.php
with
18 additions
and
5 deletions
sites/all/modules/git_include/git_include.module
+
16
−
5
View file @
4b28bcca
...
...
@@ -127,7 +127,7 @@ function git_include_admin_settings_form() {
*/
function
git_include
(
$name
)
{
if
(
!
$repo
=
git_include_load
(
$name
))
{
throw
new
Exception
(
t
(
'
Git include r
epository not found: @name'
,
array
(
'@name'
=>
$name
)));
throw
new
Exception
(
t
(
'
R
epository
info
not found: @name'
,
array
(
'@name'
=>
$name
)));
}
$dir
=
variable_get
(
'git_include_dir'
,
'public://git_include'
);
...
...
@@ -137,8 +137,19 @@ function git_include($name) {
throw
new
Exception
(
t
(
'Error resolving directory: @dir'
,
array
(
'@dir'
=>
$dir
)));
}
$command
=
'git clone '
.
$repo
->
options
[
'source_repo'
]
.
' '
.
$realpath
.
'/'
.
$repo
->
name
;
//$result = exec($command, $output, $return_var);
$command
=
'cd '
.
$realpath
.
'/'
.
$repo
->
name
.
'; git rev-parse --show-toplevel;'
;
$git_path
=
exec
(
$command
,
$output
,
$return_var
);
$repopath
=
$realpath
.
'/'
.
$repo
->
name
;
if
(
strtolower
(
$git_path
)
!==
strtolower
(
$repopath
))
{
$operation
=
'clone'
;
$command
=
'git clone '
.
$repo
->
options
[
'source_repo'
]
.
' '
.
$repopath
;
}
else
{
$operation
=
'pull'
;
$command
=
'cd '
.
$repopath
.
'; git pull;'
;
}
ob_start
();
passthru
(
$command
,
$return_var
);
...
...
@@ -147,11 +158,11 @@ function git_include($name) {
drupal_set_message
(
$result
,
'git_include'
);
if
(
$return_var
!==
0
)
{
if
(
!
is_int
(
$return_var
)
||
$return_var
!==
0
)
{
throw
new
Exception
(
t
(
'Shell command returned with status @status: @command'
,
array
(
'@command'
=>
$command
,
'@status'
=>
$return_var
)));
}
else
{
drupal_set_message
(
'Success!'
,
'status'
);
drupal_set_message
(
t
(
'Git @op completed for @repo'
,
array
(
'@op'
=>
$operation
,
'@repo'
=>
$repo
->
options
[
'label'
]))
,
'status'
);
}
return
$result
;
...
...
This diff is collapsed.
Click to expand it.
sites/all/modules/git_include/plugins/export_ui/git_include_export_ui.class.php
+
2
−
0
View file @
4b28bcca
...
...
@@ -98,6 +98,7 @@ class git_include_export_ui extends ctools_export_ui {
*/
function
run_page
(
$js
,
$input
,
$item
)
{
watchdog
(
'git_include'
,
'Running '
.
$item
->
name
);
try
{
git_include
(
$item
->
name
);
$input
[
'test_result'
]
=
theme_status_messages
(
array
(
'display'
=>
NULL
));
...
...
@@ -107,6 +108,7 @@ class git_include_export_ui extends ctools_export_ui {
watchdog_exception
(
'git_include'
,
$e
);
$input
[
'test_result'
]
=
theme_status_messages
(
array
(
'display'
=>
NULL
));
}
watchdog
(
'git_include'
,
'Finished running '
.
$item
->
name
);
if
(
!
$js
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment