Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Development_Environment
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Montaño Sarria, Andres Felipe
Development_Environment
Compare revisions
5b8a34e0de851d5730baae59f3c1f5b1bda902d3 to 9b18f5fa20d360f52b32f3d218de610009730453
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
andres.montano/development_environment
Select target project
No results found
9b18f5fa20d360f52b32f3d218de610009730453
Select Git revision
Branches
main
1 result
Swap
Target
andres.montano/development_environment
Select target project
andres.montano/development_environment
1 result
5b8a34e0de851d5730baae59f3c1f5b1bda902d3
Select Git revision
Branches
main
1 result
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
Add script to replace tecnalia.com by tecnalia.dev at git repos
· dd1de371
Montaño Sarria, Andres Felipe
authored
3 months ago
dd1de371
Merge git.code.tecnalia.com:andres.montano/development_environment
· 9b18f5fa
Montaño Sarria, Andres Felipe
authored
3 months ago
9b18f5fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/set_dotdev_remotes.bash
+90
-0
90 additions, 0 deletions
scripts/set_dotdev_remotes.bash
with
90 additions
and
0 deletions
scripts/set_dotdev_remotes.bash
0 → 100644
View file @
9b18f5fa
#!/usr/bin/env bash
#
# Updates Git remote URLs by replacing 'tecnalia.com' with 'tecnalia.dev'
# in all Git repositories under the current directory
#
set
-euo
pipefail
# Makes the script safer
# Color definitions for better readability
readonly
GREEN
=
'\033[0;32m'
readonly
YELLOW
=
'\033[1;33m'
readonly
NC
=
'\033[0m'
# No Color
usage
()
{
echo
"Usage:
$(
basename
"
$0
"
)
[-d|--dry-run]"
echo
" -d, --dry-run Show changes without applying them"
exit
1
}
# Improved argument processing
dry_run
=
0
while
[[
$#
-gt
0
]]
;
do
case
$1
in
-d
|
--dry-run
)
dry_run
=
1
shift
;;
-h
|
--help
)
usage
;;
*
)
echo
"Error: Unknown option
$1
"
usage
;;
esac
done
# Function to process a repository
process_repo
()
{
local
repo_path
=
$1
local
remote
=
$2
local
remote_url
remote_url
=
$(
git
-C
"
${
repo_path
}
"
remote get-url
"
${
remote
}
"
)
if
[[
${
remote_url
}
==
*
"tecnalia.com"
*
]]
;
then
local
new_url
=
${
remote_url
//tecnalia.com/tecnalia.dev
}
echo
-e
"
${
YELLOW
}
Found deprecated remote URL
${
NC
}
"
echo
" Repository:
${
repo_path
}
"
echo
" Remote:
${
remote
}
"
echo
" Current URL:
${
remote_url
}
"
echo
" New URL:
${
new_url
}
"
if
[[
${
dry_run
}
-eq
0
]]
;
then
if
git
-C
"
${
repo_path
}
"
remote set-url
"
${
remote
}
"
"
${
new_url
}
"
;
then
echo
-e
"
${
GREEN
}
Replacement completed!
${
NC
}
"
else
echo
" Error updating remote URL"
>
&2
return
1
fi
fi
fi
}
main
()
{
local
count
=
0
local
errors
=
0
# Use process substitution for better handling of spaces in names
while
IFS
=
read
-r
-d
''
git_folder
;
do
repo_path
=
$(
dirname
"
$(
readlink
-f
"
${
git_folder
}
"
)
"
)
while
IFS
=
read
-r
remote
;
do
if
process_repo
"
${
repo_path
}
"
"
${
remote
}
"
;
then
((
count++
))
else
((
errors++
))
fi
done
< <
(
git
-C
"
${
repo_path
}
"
remote
)
done
< <
(
find
.
-name
'.git'
-type
d
-print0
)
# Final summary
echo
echo
"Execution summary:"
echo
" Repositories processed:
$count
"
[[
$errors
-gt
0
]]
&&
echo
" Errors found:
$errors
"
[[
$dry_run
-eq
1
]]
&&
echo
" (Dry-run mode: no changes were made)"
}
main
\ No newline at end of file
This diff is collapsed.
Click to expand it.