-
Notifications
You must be signed in to change notification settings - Fork 1
User: Sub command: krep repo
krep accomplishes the function to import git-repo projects into the target gerrit server with configurable options and parameters. With version 0.2, its help prints:
$ krep repo --help
Usage: krep repo [options] ...
Download the project managed with git-repo and import to the remote server.
The project need be controlled by git-repo (created with the command
"repo init" with the "--mirror" option, whose architecture guarantees the
managed sub-projects importing to the local server.
Not like the sub-command "repo-mirror", the manifest git would be handled with
this command.
Options:
--version show program's version number and exit
-h, --help show this help message and exit
Global file options:
-w DIR, --working-dir=DIR
Set the working directory. default: /home/experi/krep
Global debugging options:
-T, --dryrun try running the command without actual changes to the
local repository and the remote server
-v, --verbose set repeatedly to output debugging info
Global other options:
--force force to execute the operations
--offsite not to fetch from the network and work offline
-j JOB, --job=JOB jobs to run with specified threads in parallel
-p PATTERN, --pattern=PATTERN
Set the patterns for the command
--pattern-file=PATTERN-FILE
Set the pattern file in XML format for patterns
--extra-option=EXTRA_OPTION
extra options in internal group with prefix. The
format is like "inject-option":
Repo options for repo init:
repo-init:platform restrict manifest projects to one platform
repo-init:reference location of mirror directory
repo-init:no-clone-bundle disable use of /clone.bundle on HTTP/HTTPS
repo-init:repo-url repo repository location
repo-init:repo-branch repo branch or revision
repo-init:no-repo-verify do not verify repo source code
Repo options for repo sync:
repo-sync:force-broken continue sync even if a project fails
repo-sync:current-branch fetch only current branch
repo-sync:jobs projects to fetch simultaneously
repo-sync:no-repo-verify do not verify repo source code
repo-sync:fetch-submodules fetch submodules from server
repo-sync:optimized-fetch only fetch project fixed to sha1
repo-sync:prune delete refs that no longer exist on remote
repo-sync:no-repo-verify do not verify repo source code
Gerrit options for create-project:
gerrit-cp:branch initial branch name
gerrit-cp:empty-commit to create initial empty commit
gerrit-cp:description description of project
gerrit-cp:owner owner(s) of the project
gerrit-cp:parent parent project
File options:
--hook-dir=HOOK_DIR
Indicates the directory with the preinstalled hooks
--output-xml-file=FILE
Set the output XML filename
Remote options:
-r REF, --refs=REF the reference prefix of the remote server
--head-refs=HEAD_REF
the reference prefix of the heads. it will override
the one of "refs"
--tag-refs=TAG_REF the reference prefix of the tags. it will override the
one of "refs"
-k, --keep-name keep current head or tag name without new refs as the
last part
--disable-gerrit Enable gerrit server
--remote=REMOTE, --server=REMOTE, --gerrit-server=REMOTE
Set gerrit url for the repository management
--repo-create Create the repository by default: True
--description=DESCRIPTION, --repo-description=DESCRIPTION
Set the repository description in gerrit when creating
the new repository. If not set, the default string
will be used. "--no-description" could suppress the
description
--prefix=PREFIX prefix on the remote location
--sha1-tag=TAG Push named tag for the SHA-1 to the remote. It works
without the option "--all"
Import options:
-a, --all Take all operations except to suppress with opposite
option like "--no-tags". The action is merged by the
sub-command
--branches, --heads
push all branches to the remote. Once option "--all"
is set, it is enabled except "--no-branches" or "--no-
heads" is set explicitly
--tags push all tags to the remote. Once option "--all" is
set, it is enabled except "--no-tags" is set
explicitly
Repo tool options:
-u URL, --manifest-url=URL
Set the git-repo manifest url
-b REVISION, --branch=REVISION, --manifest-branch=REVISION
Set the project branch or revision
-m NAME.xml, --manifest-name=NAME.xml
initialize the manifest name
Debug options:
--dump-projects Print the info of imported project
--print-new-projects
Print the new projects which isn't managed by Gerrit
Here the discussion starts following how to immigrate a git-repo project.
Before the immigration, it's good to check the project. krep repo
supports to
initialize a git-repo project and synchronize the project code. But it's
better to initialize the project without the tool to make the job easier.
NOTE: It depends on SCM policies to setup the proprietary git repositories. Generally, it's to follow Google to create AOSP projects referring to aosp.xml and adjust the repository locations back to AOSP for other 3rd party projects referring to lineage.xml. Certainly, there'll be no problem to trust the upstream, for example, CAF project if no branch conflicts need to be considered
Before the options are introduced, it's better to read how krep
works on [git]
server with [User: Sub-command: krep git-p]. The remote head
s and tag
s can
be renamed with patterns, prefixes. Actual example can refer to the project for
krep batch
with XML configuration files:
https://github.com/cadappl/krep_batch_xml.
After a successful setup of git-repo project or git-repo mirror project,
it's safe to confirm the mapping of git repositories is expected in the target
server as krep
support to relocated the git repositories in the server. What's
more, during the synchronization of the git-repo project, once one project
added, a re-check is required to know what new projects is added.
--dump-projects
and --print-new-projects
are the two options to investigate
the git-repo projects.
Here, LineageOS is good as the sample to show how the project name is adjusted with the limitation of github project nomination. As quite a lot pattern rules are needed, a modified manifest XML will be used instead of the full mirror manifest file.
Normally, it'll be convenient to work with a mirror manifest project for the git-repo projects during git-repo immigration, which contains all repositories of the projects or oganization.
On other hand, perhaps not all git repositories are required for the working projects to import. a process to filtrate the git repositories need be done before actual immigration and the rules need be written in an XML file.
NOTE: Shortly, all repoistories in AOSP mirror could be treated as needed. And other projects should be investigated again and again.
With a truested project, it's simple to accept the new changes. Option
--repo-create
is the appropriate one when constructing the command line.
$ krep repo-mirror \
--repo-create \
--extra-option "gerrit-cp:empty-commit" \
--remote git://some-git-server \
--manifest-url git://android.googlesource.com/platform/manifest \
--all \
--head-refs aosp
NOTE: The only difference of sub-commands repo
and repo-mirror
is if the
working git-repo project is a mirror one or not. Except to import from a
immediate project, it's better to use git-repo mirror project for continuous
integration.
During the development, new repositories will be added. the immigration need to
re-investigate whether the new repositories are required by the project. It
should be careful for such project with the option repo-creation
after the
confirmation of option --print-new-projects
.