精华内容
下载资源
问答
  • repo命令帮助信息汇总(附生成脚本)

    千次阅读 2019-01-11 15:15:19
    有时想查看repo命令的帮助信息,但是每次都需要去某个repo仓库下运行"repo help cmd"命令很不方便,所以这里将其统一汇总到一起。repo命令比较多,以前每个命令都单独运行然后抓取输出,这次写了...

    有时想查看repo命令的帮助信息,但是每次都需要去某个repo仓库下运行"repo help cmd"命令很不方便,所以这里将其统一汇总到一起。repo命令比较多,以前每个命令都单独运行然后抓取输出,这次写了个脚本,自动运行并保存输出。

    本文主要分文两个部分,第1部分汇总repo命令的帮助信息;第2部分附上批量运行repo命令并抓取输出的脚本,输出格式有两种,包括纯文本方式和markdown方式,稍微修改就可以用于其他命令的批量运行,如git命令或bash命令什么的。

    本文的repo命令帮助汇总信息就是通过markdown方式生成的。

    1. repo 命令帮助信息汇总

    索引


    1. repo abandon

    $ repo help abandon
    
    Summary
    -------
    Permanently abandon a development branch
    
    Usage: repo abandon <branchname> [<project>...]
    
    This subcommand permanently abandons a development branch by
    deleting it (and all its history) from your local repository.
    
    It is equivalent to "git branch -D <branchname>".
    
    Options:
      -h, --help  show this help message and exit
    

    2. repo branch

    $ repo help branch
    
    Summary
    -------
    View current topic branches
    
    Usage: repo branches [<project>...]
    
    Summarizes the currently available topic branches.
    
    Branch Display
    --------------
    
    The branch display output by this command is organized into four
    columns of information; for example:
    
     *P nocolor                   | in repo
        repo2                     |
    
    The first column contains a * if the branch is the currently
    checked out branch in any of the specified projects, or a blank
    if no project has the branch checked out.
    
    The second column contains either blank, p or P, depending upon
    the upload status of the branch.
    
     (blank): branch not yet published by repo upload
           P: all commits were published by repo upload
           p: only some commits were published by repo upload
    
    The third column contains the branch name.
    
    The fourth column (after the | separator) lists the projects that
    the branch appears in, or does not appear in.  If no project list
    is shown, then the branch appears in all projects.
    
    Options:
      -h, --help  show this help message and exit
    

    3. repo branches

    $ repo help branches
    
    Summary
    -------
    View current topic branches
    
    Usage: repo branches [<project>...]
    
    Summarizes the currently available topic branches.
    
    Branch Display
    --------------
    
    The branch display output by this command is organized into four
    columns of information; for example:
    
     *P nocolor                   | in repo
        repo2                     |
    
    The first column contains a * if the branch is the currently
    checked out branch in any of the specified projects, or a blank
    if no project has the branch checked out.
    
    The second column contains either blank, p or P, depending upon
    the upload status of the branch.
    
     (blank): branch not yet published by repo upload
           P: all commits were published by repo upload
           p: only some commits were published by repo upload
    
    The third column contains the branch name.
    
    The fourth column (after the | separator) lists the projects that
    the branch appears in, or does not appear in.  If no project list
    is shown, then the branch appears in all projects.
    
    Options:
      -h, --help  show this help message and exit
    

    4. repo checkout

    $ repo help checkout
    
    Summary
    -------
    Checkout a branch for development
    
    Usage: repo checkout <branchname> [<project>...]
    
    Options:
      -h, --help  show this help message and exit
    
    Description
    -----------
    The 'repo checkout' command checks out an existing branch that was
    previously created by 'repo start'.
    
    The command is equivalent to:
    
      repo forall [<project>...] -c git checkout <branchname>
    

    5. repo cherry-pick

    $ repo help cherry-pick
    
    Summary
    -------
    Cherry-pick a change.
    
    Usage: repo cherry-pick <sha1>
    
    Options:
      -h, --help  show this help message and exit
    
    Description
    -----------
    'repo cherry-pick' cherry-picks a change from one branch to another. The
    change id will be updated, and a reference to the old change id will be
    added.
    

    6. repo diff

    $ repo help diff
    
    Summary
    -------
    Show changes between commit and working tree
    
    Usage: repo diff [<project>...]
    
    The -u option causes 'repo diff' to generate diff output with file paths
    relative to the repository root, so the output can be applied
    to the Unix 'patch' command.
    
    Options:
      -h, --help      show this help message and exit
      -u, --absolute  Paths are relative to the repository root
    

    7. repo diffmanifests

    $ repo help diffmanifests
    
    Summary
    -------
    Manifest diff utility
    
    Usage: repo diffmanifests manifest1.xml [manifest2.xml] [options]
    
    Options:
      -h, --help            show this help message and exit
      --raw                 Display raw diff.
      --no-color            does not display the diff in color.
      --pretty-format=<FORMAT>
                            print the log using a custom git pretty format string
    
    Description
    -----------
    The repo diffmanifests command shows differences between project
    revisions of manifest1 and manifest2. if manifest2 is not specified,
    current manifest.xml will be used instead. Both absolute and relative
    paths may be used for manifests. Relative paths start from project's
    ".repo/manifests" folder.
    
    The --raw option Displays the diff in a way that facilitates parsing,
    the project pattern will be <status> <path> <revision from> [<revision
    to>] and the commit pattern will be <status> <onelined log> with status
    values respectively :
    
      A = Added project
      R = Removed project
      C = Changed project
      U = Project with unreachable revision(s) (revision(s) not found)
    
    for project, and
    
       A = Added commit
       R = Removed commit
    
    for a commit.
    
    Only changed projects may contain commits, and commit status always
    starts with a space, and are part of last printed project. Unreachable
    revisions may occur if project is not up to date or if repo has not been
    initialized with all the groups, in which case some projects won't be
    synced and their revisions won't be found.
    

    8. repo download

    $ repo help download
    
    Summary
    -------
    Download and checkout a change
    
    Usage: repo download {project change[/patchset]}...
    
    Options:
      -h, --help         show this help message and exit
      -c, --cherry-pick  cherry-pick instead of checkout
      -r, --revert       revert instead of checkout
      -f, --ff-only      force fast-forward merge
    
    Description
    -----------
    The 'repo download' command downloads a change from the review system
    and makes it available in your project's local working directory.
    

    9. repo forall

    $ repo help forall
    
    Summary
    -------
    Run a shell command in each project
    
    Usage: repo forall [<project>...] -c <command> [<arg>...]
    repo forall -r str1 [str2] ... -c <command> [<arg>...]"
    
    Options:
      -h, --help            show this help message and exit
      -r, --regex           Execute the command only on projects matching regex or
                            wildcard expression
      -i, --inverse-regex   Execute the command only on projects not matching
                            regex or wildcard expression
      -g GROUPS, --groups=GROUPS
                            Execute the command only on projects matching the
                            specified groups
      -c, --command         Command (and arguments) to execute
      -e, --abort-on-errors
                            Abort if a command exits unsuccessfully
    
      Output:
        -p                  Show project headers before output
        -v, --verbose       Show command error messages
        -j JOBS, --jobs=JOBS
                            number of commands to execute simultaneously
    
    Description
    -----------
    Executes the same shell command in each project.
    
    The -r option allows running the command only on projects matching regex
    or wildcard expression.
    
    Output Formatting
    -----------------
    The -p option causes 'repo forall' to bind pipes to the command's stdin,
    stdout and stderr streams, and pipe all output into a continuous stream
    that is displayed in a single pager session. Project headings are
    inserted before the output of each command is displayed. If the command
    produces no output in a project, no heading is displayed.
    
    The formatting convention used by -p is very suitable for some types of
    searching, e.g. `repo forall -p -c git log -SFoo` will print all commits
    that add or remove references to Foo.
    
    The -v option causes 'repo forall' to display stderr messages if a
    command produces output only on stderr. Normally the -p option causes
    command output to be suppressed until the command produces at least one
    byte of output on stdout.
    
    Environment
    -----------
    pwd is the project's working directory. If the current client is a
    mirror client, then pwd is the Git repository.
    
    REPO_PROJECT is set to the unique name of the project.
    
    REPO_PATH is the path relative the the root of the client.
    
    REPO_REMOTE is the name of the remote system from the manifest.
    
    REPO_LREV is the name of the revision from the manifest, translated to a
    local tracking branch. If you need to pass the manifest revision to a
    locally executed git command, use REPO_LREV.
    
    REPO_RREV is the name of the revision from the manifest, exactly as
    written in the manifest.
    
    REPO_COUNT is the total number of projects being iterated.
    
    REPO_I is the current (1-based) iteration count. Can be used in
    conjunction with REPO_COUNT to add a simple progress indicator to your
    command.
    
    REPO__* are any extra environment variables, specified by the
    "annotation" element under any project element. This can be useful for
    differentiating trees based on user-specific criteria, or simply
    annotating tree details.
    
    shell positional arguments ($1, $2, .., $#) are set to any arguments
    following <command>.
    
    Unless -p is used, stdin, stdout, stderr are inherited from the terminal
    and are not redirected.
    
    If -e is used, when a command exits unsuccessfully, 'repo forall' will
    abort without iterating through the remaining projects.
    

    10. repo gitc-delete

    $ repo help gitc-delete
    
    Summary
    -------
    Delete a GITC Client.
    
    Usage: repo gitc-delete
    
    Options:
      -h, --help   show this help message and exit
      -f, --force  Force the deletion (no prompt).
    
    Description
    -----------
    This subcommand deletes the current GITC client, deleting the GITC
    manifest and all locally downloaded sources.
    

    11. repo gitc-init

    $ repo help gitc-init
    
    Summary
    -------
    Initialize a GITC Client.
    
    Usage: repo gitc-init [options] [client name]
    
    Options:
      -h, --help            show this help message and exit
    
      Logging options:
        -q, --quiet         be quiet
    
      Manifest options:
        -u URL, --manifest-url=URL
                            manifest repository location
        -b REVISION, --manifest-branch=REVISION
                            manifest branch or revision
        -m NAME.xml, --manifest-name=NAME.xml
                            initial manifest file
        --mirror            create a replica of the remote repositories rather
                            than a client working directory
        --reference=DIR     location of mirror directory
        --depth=DEPTH       create a shallow clone with given depth; see git clone
        --archive           checkout an archive instead of a git repository for
                            each project. See git archive.
        -g GROUP, --groups=GROUP
                            restrict manifest projects to ones with specified
                            group(s) [default|all|G1,G2,G3|G4,-G5,-G6]
        -p PLATFORM, --platform=PLATFORM
                            restrict manifest projects to ones with a specified
                            platform group [auto|all|none|linux|darwin|...]
        --no-clone-bundle   disable use of /clone.bundle on HTTP/HTTPS
    
      repo Version options:
        --repo-url=URL      repo repository location
        --repo-branch=REVISION
                            repo branch or revision
        --no-repo-verify    do not verify repo source code
    
      Other options:
        --config-name       Always prompt for name/e-mail
    
      GITC options:
        -f MANIFEST_FILE, --manifest-file=MANIFEST_FILE
                            Optional manifest file to use for this GITC client.
        -c GITC_CLIENT, --gitc-client=GITC_CLIENT
                            The name of the gitc_client instance to create or
                            modify.
    
    Description
    -----------
    The 'repo gitc-init' command is ran to initialize a new GITC client for
    use with the GITC file system.
    
    This command will setup the client directory, initialize repo, just like
    repo init does, and then downloads the manifest collection and installs
    it in the .repo/directory of the GITC client.
    
    Once this is done, a GITC manifest is generated by pulling the HEAD SHA
    for each project and generates the properly formatted XML file and
    installs it as .manifest in the GITC client directory.
    
    The -c argument is required to specify the GITC client name.
    
    The optional -f argument can be used to specify the manifest file to use
    for this GITC client.
    

    12. repo grep

    $ repo help grep
    
    Summary
    -------
    Print lines matching a pattern
    
    Usage: repo grep {pattern | -e pattern} [<project>...]
    
    Options:
      -h, --help            show this help message and exit
    
      Sources:
        --cached            Search the index, instead of the work tree
        -r TREEish, --revision=TREEish
                            Search TREEish, instead of the work tree
    
      Pattern:
        -e PATTERN          Pattern to search for
        -i, --ignore-case   Ignore case differences
        -a, --text          Process binary files as if they were text
        -I                  Don't match the pattern in binary files
        -w, --word-regexp   Match the pattern only at word boundaries
        -v, --invert-match  Select non-matching lines
        -G, --basic-regexp  Use POSIX basic regexp for patterns (default)
        -E, --extended-regexp
                            Use POSIX extended regexp for patterns
        -F, --fixed-strings
                            Use fixed strings (not regexp) for pattern
    
      Pattern Grouping:
        --all-match         Limit match to lines that have all patterns
        --and, --or, --not  Boolean operators to combine patterns
        -(, -)              Boolean operator grouping
    
      Output:
        -n                  Prefix the line number to matching lines
        -C CONTEXT          Show CONTEXT lines around match
        -B CONTEXT          Show CONTEXT lines before match
        -A CONTEXT          Show CONTEXT lines after match
        -l, --name-only, --files-with-matches
                            Show only file names containing matching lines
        -L, --files-without-match
                            Show only file names not containing matching lines
    
    Description
    -----------
    Search for the specified patterns in all project files.
    
    Boolean Options
    ---------------
    The following options can appear as often as necessary to express the
    pattern to locate:
    
     -e PATTERN
     --and, --or, --not, -(, -)
    
    Further, the -r/--revision option may be specified multiple times in
    order to scan multiple trees. If the same file matches in more than one
    tree, only the first result is reported, prefixed by the revision name
    it was found under.
    
    Examples
    --------
    Look for a line that has '#define' and either 'MAX_PATH or 'PATH_MAX':
    
      repo grep -e '#define' --and -\( -e MAX_PATH -e PATH_MAX \)
    
    Look for a line that has 'NODE' or 'Unexpected' in files that contain a
    line that matches both expressions:
    
      repo grep --all-match -e NODE -e Unexpected
    

    13. repo help

    $ repo help help
    
    Summary
    -------
    Display detailed help on a command
    
    Usage: repo help [--all|command]
    
    Options:
      -h, --help  show this help message and exit
      -a, --all   show the complete list of commands
    
    Description
    -----------
    Displays detailed usage information about a command.
    

    14. repo info

    $ repo help info
    
    Summary
    -------
    Get info on the manifest branch, current branch or unmerged branches
    
    Usage: repo info [-dl] [-o [-b]] [<project>...]
    
    Options:
      -h, --help            show this help message and exit
      -d, --diff            show full info and commit diff including remote
                            branches
      -o, --overview        show overview of all local commits
      -b, --current-branch  consider only checked out branches
      -l, --local-only      Disable all remote operations
    

    15. repo init

    $ repo help init
    
    Summary
    -------
    Initialize repo in the current directory
    
    Usage: repo init [options]
    
    Options:
      -h, --help            show this help message and exit
    
      Logging options:
        -q, --quiet         be quiet
    
      Manifest options:
        -u URL, --manifest-url=URL
                            manifest repository location
        -b REVISION, --manifest-branch=REVISION
                            manifest branch or revision
        -m NAME.xml, --manifest-name=NAME.xml
                            initial manifest file
        --mirror            create a replica of the remote repositories rather
                            than a client working directory
        --reference=DIR     location of mirror directory
        --depth=DEPTH       create a shallow clone with given depth; see git clone
        --archive           checkout an archive instead of a git repository for
                            each project. See git archive.
        -g GROUP, --groups=GROUP
                            restrict manifest projects to ones with specified
                            group(s) [default|all|G1,G2,G3|G4,-G5,-G6]
        -p PLATFORM, --platform=PLATFORM
                            restrict manifest projects to ones with a specified
                            platform group [auto|all|none|linux|darwin|...]
        --no-clone-bundle   disable use of /clone.bundle on HTTP/HTTPS
    
      repo Version options:
        --repo-url=URL      repo repository location
        --repo-branch=REVISION
                            repo branch or revision
        --no-repo-verify    do not verify repo source code
    
      Other options:
        --config-name       Always prompt for name/e-mail
    
    Description
    -----------
    The 'repo init' command is run once to install and initialize repo. The
    latest repo source code and manifest collection is downloaded from the
    server and is installed in the .repo/ directory in the current working
    directory.
    
    The optional -b argument can be used to select the manifest branch to
    checkout and use. If no branch is specified, master is assumed.
    
    The optional -m argument can be used to specify an alternate manifest to
    be used. If no manifest is specified, the manifest default.xml will be
    used.
    
    The --reference option can be used to point to a directory that has the
    content of a --mirror sync. This will make the working directory use as
    much data as possible from the local reference directory when fetching
    from the server. This will make the sync go a lot faster by reducing
    data traffic on the network.
    
    The --no-clone-bundle option disables any attempt to use
    $URL/clone.bundle to bootstrap a new Git repository from a resumeable
    bundle file on a content delivery network. This may be necessary if
    there are problems with the local Python HTTP client or proxy
    configuration, but the Git binary works.
    
    Switching Manifest Branches
    ---------------------------
    To switch to another manifest branch, `repo init -b otherbranch` may be
    used in an existing client. However, as this only updates the manifest,
    a subsequent `repo sync` (or `repo sync -d`) is necessary to update the
    working directory files.
    

    16. repo list

    $ repo help list
    
    Summary
    -------
    List projects and their associated directories
    
    Usage: repo list [-f] [<project>...]
    repo list [-f] -r str1 [str2]..."
    
    Options:
      -h, --help            show this help message and exit
      -r, --regex           Filter the project list based on regex or wildcard
                            matching of strings
      -g GROUPS, --groups=GROUPS
                            Filter the project list based on the groups the
                            project is in
      -f, --fullpath        Display the full work tree path instead of the
                            relative path
      -n, --name-only       Display only the name of the repository
      -p, --path-only       Display only the path of the repository
    
    Description
    -----------
    List all projects; pass '.' to list the project for the cwd.
    
    This is similar to running: repo forall -c 'echo "$REPO_PATH :
    $REPO_PROJECT"'.
    

    17. repo manifest

    $ repo help manifest
    
    Summary
    -------
    Manifest inspection utility
    
    Usage: repo manifest [-o {-|NAME.xml} [-r]]
    
    Options:
      -h, --help            show this help message and exit
      -r, --revision-as-HEAD
                            Save revisions as current HEAD
      --suppress-upstream-revision
                            If in -r mode, do not write the upstream field.  Only
                            of use if the branch names for a sha1 manifest are
                            sensitive.
      -o -|NAME.xml, --output-file=-|NAME.xml
                            File to save the manifest to
    
    Description
    -----------
    With the -o option, exports the current manifest for inspection. The
    manifest and (if present) local_manifest.xml are combined together to
    produce a single manifest file. This file can be stored in a Git
    repository for use during future 'repo init' invocations.
    
    repo Manifest Format
    ====================
    A repo manifest describes the structure of a repo client; that is the
    directories that are visible and where they should be obtained from with
    git.
    
    The basic structure of a manifest is a bare Git repository holding a
    single 'default.xml' XML file in the top level directory.
    
    Manifests are inherently version controlled, since they are kept within
    a Git repository. Updates to manifests are automatically obtained by
    clients during `repo sync`.
    
    XML File Format
    ---------------
    A manifest XML file (e.g. 'default.xml') roughly conforms to the
    following DTD:
    
      <!DOCTYPE manifest [
        <!ELEMENT manifest (notice?,
                            remote*,
                            default?,
                            manifest-server?,
                            remove-project*,
                            project*,
                            extend-project*,
                            repo-hooks?)>
    
        <!ELEMENT notice (#PCDATA)>
    
        <!ELEMENT remote (EMPTY)>
        <!ATTLIST remote name         ID    #REQUIRED>
        <!ATTLIST remote alias        CDATA #IMPLIED>
        <!ATTLIST remote fetch        CDATA #REQUIRED>
        <!ATTLIST remote pushurl      CDATA #IMPLIED>
        <!ATTLIST remote review       CDATA #IMPLIED>
        <!ATTLIST remote revision     CDATA #IMPLIED>
    
        <!ELEMENT default (EMPTY)>
        <!ATTLIST default remote      IDREF #IMPLIED>
        <!ATTLIST default revision    CDATA #IMPLIED>
        <!ATTLIST default dest-branch CDATA #IMPLIED>
        <!ATTLIST default sync-j      CDATA #IMPLIED>
        <!ATTLIST default sync-c      CDATA #IMPLIED>
        <!ATTLIST default sync-s      CDATA #IMPLIED>
    
        <!ELEMENT manifest-server (EMPTY)>
        <!ATTLIST manifest-server url CDATA #REQUIRED>
    
        <!ELEMENT project (annotation*,
                           project*,
                           copyfile*,
                           linkfile*)>
        <!ATTLIST project name        CDATA #REQUIRED>
        <!ATTLIST project path        CDATA #IMPLIED>
        <!ATTLIST project remote      IDREF #IMPLIED>
        <!ATTLIST project revision    CDATA #IMPLIED>
        <!ATTLIST project dest-branch CDATA #IMPLIED>
        <!ATTLIST project groups      CDATA #IMPLIED>
        <!ATTLIST project sync-c      CDATA #IMPLIED>
        <!ATTLIST project sync-s      CDATA #IMPLIED>
        <!ATTLIST project upstream CDATA #IMPLIED>
        <!ATTLIST project clone-depth CDATA #IMPLIED>
        <!ATTLIST project force-path CDATA #IMPLIED>
    
        <!ELEMENT annotation (EMPTY)>
        <!ATTLIST annotation name  CDATA #REQUIRED>
        <!ATTLIST annotation value CDATA #REQUIRED>
        <!ATTLIST annotation keep  CDATA "true">
    
        <!ELEMENT copyfile (EMPTY)>
        <!ATTLIST copyfile src  CDATA #REQUIRED>
        <!ATTLIST copyfile dest CDATA #REQUIRED>
    
        <!ELEMENT linkfile (EMPTY)>
        <!ATTLIST linkfile src CDATA #REQUIRED>
        <!ATTLIST linkfile dest CDATA #REQUIRED>
    
        <!ELEMENT extend-project (EMPTY)>
        <!ATTLIST extend-project name CDATA #REQUIRED>
        <!ATTLIST extend-project path CDATA #IMPLIED>
        <!ATTLIST extend-project groups CDATA #IMPLIED>
    
        <!ELEMENT remove-project (EMPTY)>
        <!ATTLIST remove-project name  CDATA #REQUIRED>
    
        <!ELEMENT repo-hooks (EMPTY)>
        <!ATTLIST repo-hooks in-project CDATA #REQUIRED>
        <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED>
    
        <!ELEMENT include      (EMPTY)>
        <!ATTLIST include name CDATA #REQUIRED>
      ]>
    
    A description of the elements and their attributes follows.
    
    Element manifest
    ----------------
    The root element of the file.
    
    Element remote
    --------------
    One or more remote elements may be specified. Each remote element
    specifies a Git URL shared by one or more projects and (optionally) the
    Gerrit review server those projects upload changes through.
    
    Attribute `name`: A short name unique to this manifest file. The name
    specified here is used as the remote name in each project's .git/config,
    and is therefore automatically available to commands like `git fetch`,
    `git remote`, `git pull` and `git push`.
    
    Attribute `alias`: The alias, if specified, is used to override `name`
    to be set as the remote name in each project's .git/config. Its value
    can be duplicated while attribute `name` has to be unique in the
    manifest file. This helps each project to be able to have same remote
    name which actually points to different remote url.
    
    Attribute `fetch`: The Git URL prefix for all projects which use this
    remote. Each project's name is appended to this prefix to form the
    actual URL used to clone the project.
    
    Attribute `pushurl`: The Git "push" URL prefix for all projects which
    use this remote. Each project's name is appended to this prefix to form
    the actual URL used to "git push" the project. This attribute is
    optional; if not specified then "git push" will use the same URL as the
    `fetch` attribute.
    
    Attribute `review`: Hostname of the Gerrit server where reviews are
    uploaded to by `repo upload`. This attribute is optional; if not
    specified then `repo upload` will not function.
    
    Attribute `revision`: Name of a Git branch (e.g. `master` or
    `refs/heads/master`). Remotes with their own revision will override the
    default revision.
    
    Element default
    ---------------
    At most one default element may be specified. Its remote and revision
    attributes are used when a project element does not specify its own
    remote or revision attribute.
    
    Attribute `remote`: Name of a previously defined remote element. Project
    elements lacking a remote attribute of their own will use this remote.
    
    Attribute `revision`: Name of a Git branch (e.g. `master` or
    `refs/heads/master`). Project elements lacking their own revision
    attribute will use this revision.
    
    Attribute `dest-branch`: Name of a Git branch (e.g. `master`). Project
    elements not setting their own `dest-branch` will inherit this value. If
    this value is not set, projects will use `revision` by default instead.
    
    Attribute `sync-j`: Number of parallel jobs to use when synching.
    
    Attribute `sync-c`: Set to true to only sync the given Git branch
    (specified in the `revision` attribute) rather than the whole ref space.
    Project elements lacking a sync-c element of their own will use this
    value.
    
    Attribute `sync-s`: Set to true to also sync sub-projects.
    
    Element manifest-server
    -----------------------
    At most one manifest-server may be specified. The url attribute is used
    to specify the URL of a manifest server, which is an XML RPC service.
    
    The manifest server should implement the following RPC methods:
    
      GetApprovedManifest(branch, target)
    
    Return a manifest in which each project is pegged to a known good
    revision for the current branch and target. This is used by repo sync
    when the --smart-sync option is given.
    
    The target to use is defined by environment variables TARGET_PRODUCT and
    TARGET_BUILD_VARIANT. These variables are used to create a string of the
    form $TARGET_PRODUCT-$TARGET_BUILD_VARIANT, e.g. passion-userdebug. If
    one of those variables or both are not present, the program will call
    GetApprovedManifest without the target parameter and the manifest server
    should choose a reasonable default target.
    
      GetManifest(tag)
    
    Return a manifest in which each project is pegged to the revision at the
    specified tag. This is used by repo sync when the --smart-tag option is
    given.
    
    Element project
    ---------------
    One or more project elements may be specified. Each element describes a
    single Git repository to be cloned into the repo client workspace. You
    may specify Git-submodules by creating a nested project. Git-submodules
    will be automatically recognized and inherit their parent's attributes,
    but those may be overridden by an explicitly specified project element.
    
    Attribute `name`: A unique name for this project. The project's name is
    appended onto its remote's fetch URL to generate the actual URL to
    configure the Git remote with. The URL gets formed as:
    
      ${remote_fetch}/${project_name}.git
    
    where ${remote_fetch} is the remote's fetch attribute and
    ${project_name} is the project's name attribute. The suffix ".git" is
    always appended as repo assumes the upstream is a forest of bare Git
    repositories. If the project has a parent element, its name will be
    prefixed by the parent's.
    
    The project name must match the name Gerrit knows, if Gerrit is being
    used for code reviews.
    
    Attribute `path`: An optional path relative to the top directory of the
    repo client where the Git working directory for this project should be
    placed. If not supplied the project name is used. If the project has a
    parent element, its path will be prefixed by the parent's.
    
    Attribute `remote`: Name of a previously defined remote element. If not
    supplied the remote given by the default element is used.
    
    Attribute `revision`: Name of the Git branch the manifest wants to track
    for this project. Names can be relative to refs/heads (e.g. just
    "master") or absolute (e.g. "refs/heads/master"). Tags and/or explicit
    SHA-1s should work in theory, but have not been extensively tested. If
    not supplied the revision given by the remote element is used if
    applicable, else the default element is used.
    
    Attribute `dest-branch`: Name of a Git branch (e.g. `master`). When
    using `repo upload`, changes will be submitted for code review on this
    branch. If unspecified both here and in the default element, `revision`
    is used instead.
    
    Attribute `groups`: List of groups to which this project belongs,
    whitespace or comma separated. All projects belong to the group "all",
    and each project automatically belongs to a group of its name:`name` and
    path:`path`. E.g. for <project name="monkeys" path="barrel-of"/>, that
    project definition is implicitly in the following manifest groups:
    default, name:monkeys, and path:barrel-of. If you place a project in the
    group "notdefault", it will not be automatically downloaded by repo. If
    the project has a parent element, the `name` and `path` here are the
    prefixed ones.
    
    Attribute `sync-c`: Set to true to only sync the given Git branch
    (specified in the `revision` attribute) rather than the whole ref space.
    
    Attribute `sync-s`: Set to true to also sync sub-projects.
    
    Attribute `upstream`: Name of the Git ref in which a sha1 can be found.
    Used when syncing a revision locked manifest in -c mode to avoid having
    to sync the entire ref space.
    
    Attribute `clone-depth`: Set the depth to use when fetching this
    project. If specified, this value will override any value given to repo
    init with the --depth option on the command line.
    
    Attribute `force-path`: Set to true to force this project to create the
    local mirror repository according to its `path` attribute (if supplied)
    rather than the `name` attribute. This attribute only applies to the
    local mirrors syncing, it will be ignored when syncing the projects in a
    client working directory.
    
    Element extend-project
    ----------------------
    Modify the attributes of the named project.
    
    This element is mostly useful in a local manifest file, to modify the
    attributes of an existing project without completely replacing the
    existing project definition. This makes the local manifest more robust
    against changes to the original manifest.
    
    Attribute `path`: If specified, limit the change to projects checked out
    at the specified path, rather than all projects with the given name.
    
    Attribute `groups`: List of additional groups to which this project
    belongs. Same syntax as the corresponding element of `project`.
    
    Element annotation
    ------------------
    Zero or more annotation elements may be specified as children of a
    project element. Each element describes a name-value pair that will be
    exported into each project's environment during a 'forall' command,
    prefixed with REPO__. In addition, there is an optional attribute "keep"
    which accepts the case insensitive values "true" (default) or "false".
    This attribute determines whether or not the annotation will be kept
    when exported with the manifest subcommand.
    
    Element copyfile
    ----------------
    Zero or more copyfile elements may be specified as children of a project
    element. Each element describes a src-dest pair of files; the "src" file
    will be copied to the "dest" place during 'repo sync' command. "src" is
    project relative, "dest" is relative to the top of the tree.
    
    Element linkfile
    ----------------
    It's just like copyfile and runs at the same time as copyfile but
    instead of copying it creates a symlink.
    
    Element remove-project
    ----------------------
    Deletes the named project from the internal manifest table, possibly
    allowing a subsequent project element in the same manifest file to
    replace the project with a different source.
    
    This element is mostly useful in a local manifest file, where the user
    can remove a project, and possibly replace it with their own definition.
    
    Element include
    ---------------
    This element provides the capability of including another manifest file
    into the originating manifest. Normal rules apply for the target
    manifest to include - it must be a usable manifest on its own.
    
    Attribute `name`: the manifest to include, specified relative to the
    manifest repository's root.
    
    Local Manifests
    ===============
    Additional remotes and projects may be added through local manifest
    files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.
    
    For example:
    
      $ ls .repo/local_manifests
      local_manifest.xml
      another_local_manifest.xml
    
      $ cat .repo/local_manifests/local_manifest.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <manifest>
        <project path="manifest"
                 name="tools/manifest" />
        <project path="platform-manifest"
                 name="platform/manifest" />
      </manifest>
    
    Users may add projects to the local manifest(s) prior to a `repo sync`
    invocation, instructing repo to automatically download and manage these
    extra projects.
    
    Manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml` will be
    loaded in alphabetical order.
    
    Additional remotes and projects may also be added through a local
    manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. This method is
    deprecated in favor of using multiple manifest files as mentioned above.
    
    If `$TOP_DIR/.repo/local_manifest.xml` exists, it will be loaded before
    any manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.
    

    18. repo overview

    $ repo help overview
    
    Summary
    -------
    Display overview of unmerged project branches
    
    Usage: repo overview [--current-branch] [<project>...]
    
    Options:
      -h, --help            show this help message and exit
      -b, --current-branch  Consider only checked out branches
    
    Description
    -----------
    The 'repo overview' command is used to display an overview of the
    projects branches, and list any local commits that have not yet been
    merged into the project.
    
    The -b/--current-branch option can be used to restrict the output to
    only branches currently checked out in each project. By default, all
    branches are displayed.
    

    19. repo prune

    $ repo help prune
    
    Summary
    -------
    Prune (delete) already merged topics
    
    Usage: repo prune [<project>...]
    
    Options:
      -h, --help  show this help message and exit
    

    20. repo rebase

    $ repo help rebase
    
    Summary
    -------
    Rebase local branches on upstream branch
    
    Usage: repo rebase {[<project>...] | -i <project>...}
    
    Options:
      -h, --help           show this help message and exit
      -i, --interactive    interactive rebase (single project only)
      -f, --force-rebase   Pass --force-rebase to git rebase
      --no-ff              Pass --no-ff to git rebase
      -q, --quiet          Pass --quiet to git rebase
      --autosquash         Pass --autosquash to git rebase
      --whitespace=WS      Pass --whitespace to git rebase
      --auto-stash         Stash local modifications before starting
      -m, --onto-manifest  Rebase onto the manifest version instead of upstream
                           HEAD.  This helps to make sure the local tree stays
                           consistent if you previously synced to a manifest.
    
    Description
    -----------
    'repo rebase' uses git rebase to move local changes in the current topic
    branch to the HEAD of the upstream history, useful when you have made
    commits in a topic branch but need to incorporate new upstream changes
    "underneath" them.
    

    21. repo selfupdate

    $ repo help selfupdate
    
    Summary
    -------
    Update repo to the latest version
    
    Usage: repo selfupdate
    
    Options:
      -h, --help          show this help message and exit
    
      repo Version options:
        --no-repo-verify  do not verify repo source code
    
    Description
    -----------
    The 'repo selfupdate' command upgrades repo to the latest version, if a
    newer version is available.
    
    Normally this is done automatically by 'repo sync' and does not need to
    be performed by an end-user.
    

    22. repo smartsync

    $ repo help smartsync
    
    Summary
    -------
    Update working tree to the latest known good revision
    
    Usage: repo smartsync [<project>...]
    
    Options:
      -h, --help            show this help message and exit
      -f, --force-broken    continue sync even if a project fails to sync
      --force-sync          overwrite an existing git directory if it needs to
                            point to a different object directory. WARNING: this
                            may cause loss of data
      -l, --local-only      only update working tree, don't fetch
      -n, --network-only    fetch only, don't update working tree
      -d, --detach          detach projects back to manifest revision
      -c, --current-branch  fetch only current branch from server
      -q, --quiet           be more quiet
      -j JOBS, --jobs=JOBS  projects to fetch simultaneously (default 1)
      -m NAME.xml, --manifest-name=NAME.xml
                            temporary manifest to use for this sync
      --no-clone-bundle     disable use of /clone.bundle on HTTP/HTTPS
      -u MANIFEST_SERVER_USERNAME, --manifest-server-username=MANIFEST_SERVER_USERNAME
                            username to authenticate with the manifest server
      -p MANIFEST_SERVER_PASSWORD, --manifest-server-password=MANIFEST_SERVER_PASSWORD
                            password to authenticate with the manifest server
      --fetch-submodules    fetch submodules from server
      --no-tags             don't fetch tags
      --optimized-fetch     only fetch projects fixed to sha1 if revision does not
                            exist locally
      --prune               delete refs that no longer exist on the remote
    
      repo Version options:
        --no-repo-verify    do not verify repo source code
    
    Description
    -----------
    The 'repo smartsync' command is a shortcut for sync -s.
    

    23. repo stage

    $ repo help stage
    
    Summary
    -------
    Stage file(s) for commit
    
    Usage: repo stage -i [<project>...]
    
    Options:
      -h, --help         show this help message and exit
      -i, --interactive  use interactive staging
    
    Description
    -----------
    The 'repo stage' command stages files to prepare the next commit.
    

    24. repo start

    $ repo help start
    
    Summary
    -------
    Start a new branch for development
    
    Usage: repo start <newbranchname> [--all | <project>...]
    
    Options:
      -h, --help  show this help message and exit
      --all       begin branch in all projects
    
    Description
    -----------
    'repo start' begins a new branch of development, starting from the
    revision specified in the manifest.
    

    25. repo status

    $ repo help status
    
    Summary
    -------
    Show the working tree status
    
    Usage: repo status [<project>...]
    
    Options:
      -h, --help            show this help message and exit
      -j JOBS, --jobs=JOBS  number of projects to check simultaneously
      -o, --orphans         include objects in working directory outside of repo
                            projects
    
    Description
    -----------
    'repo status' compares the working tree to the staging area (aka index),
    and the most recent commit on this branch (HEAD), in each project
    specified. A summary is displayed, one line per file where there is a
    difference between these three states.
    
    The -j/--jobs option can be used to run multiple status queries in
    parallel.
    
    The -o/--orphans option can be used to show objects that are in the
    working directory, but not associated with a repo project. This includes
    unmanaged top-level files and directories, but also includes deeper
    items. For example, if dir/subdir/proj1 and dir/subdir/proj2 are repo
    projects, dir/subdir/proj3 will be shown if it is not known to repo.
    
    Status Display
    --------------
    The status display is organized into three columns of information, for
    example if the file 'subcmds/status.py' is modified in the project
    'repo' on branch 'devwork':
    
      project repo/                                   branch devwork
       -m     subcmds/status.py
    
    The first column explains how the staging area (index) differs from the
    last commit (HEAD). Its values are always displayed in upper case and
    have the following meanings:
    
     -:  no difference
     A:  added         (not in HEAD,     in index                     )
     M:  modified      (    in HEAD,     in index, different content  )
     D:  deleted       (    in HEAD, not in index                     )
     R:  renamed       (not in HEAD,     in index, path changed       )
     C:  copied        (not in HEAD,     in index, copied from another)
     T:  mode changed  (    in HEAD,     in index, same content       )
     U:  unmerged; conflict resolution required
    
    The second column explains how the working directory differs from the
    index. Its values are always displayed in lower case and have the
    following meanings:
    
     -:  new / unknown (not in index,     in work tree                )
     m:  modified      (    in index,     in work tree, modified      )
     d:  deleted       (    in index, not in work tree                )
    

    26. repo sync

    $ repo help sync
    
    Summary
    -------
    Update working tree to the latest revision
    
    Usage: repo sync [<project>...]
    
    Options:
      -h, --help            show this help message and exit
      -f, --force-broken    continue sync even if a project fails to sync
      --force-sync          overwrite an existing git directory if it needs to
                            point to a different object directory. WARNING: this
                            may cause loss of data
      -l, --local-only      only update working tree, don't fetch
      -n, --network-only    fetch only, don't update working tree
      -d, --detach          detach projects back to manifest revision
      -c, --current-branch  fetch only current branch from server
      -q, --quiet           be more quiet
      -j JOBS, --jobs=JOBS  projects to fetch simultaneously (default 1)
      -m NAME.xml, --manifest-name=NAME.xml
                            temporary manifest to use for this sync
      --no-clone-bundle     disable use of /clone.bundle on HTTP/HTTPS
      -u MANIFEST_SERVER_USERNAME, --manifest-server-username=MANIFEST_SERVER_USERNAME
                            username to authenticate with the manifest server
      -p MANIFEST_SERVER_PASSWORD, --manifest-server-password=MANIFEST_SERVER_PASSWORD
                            password to authenticate with the manifest server
      --fetch-submodules    fetch submodules from server
      --no-tags             don't fetch tags
      --optimized-fetch     only fetch projects fixed to sha1 if revision does not
                            exist locally
      --prune               delete refs that no longer exist on the remote
      -s, --smart-sync      smart sync using manifest from the latest known good
                            build
      -t SMART_TAG, --smart-tag=SMART_TAG
                            smart sync using manifest from a known tag
    
      repo Version options:
        --no-repo-verify    do not verify repo source code
    
    Description
    -----------
    The 'repo sync' command synchronizes local project directories with the
    remote repositories specified in the manifest. If a local project does
    not yet exist, it will clone a new local directory from the remote
    repository and set up tracking branches as specified in the manifest. If
    the local project already exists, 'repo sync' will update the remote
    branches and rebase any new local changes on top of the new remote
    changes.
    
    'repo sync' will synchronize all projects listed at the command line.
    Projects can be specified either by name, or by a relative or absolute
    path to the project's local directory. If no projects are specified,
    'repo sync' will synchronize all projects listed in the manifest.
    
    The -d/--detach option can be used to switch specified projects back to
    the manifest revision. This option is especially helpful if the project
    is currently on a topic branch, but the manifest revision is temporarily
    needed.
    
    The -s/--smart-sync option can be used to sync to a known good build as
    specified by the manifest-server element in the current manifest. The
    -t/--smart-tag option is similar and allows you to specify a custom
    tag/label.
    
    The -u/--manifest-server-username and -p/--manifest-server-password
    options can be used to specify a username and password to authenticate
    with the manifest server when using the -s or -t option.
    
    If -u and -p are not specified when using the -s or -t option, 'repo
    sync' will attempt to read authentication credentials for the manifest
    server from the user's .netrc file.
    
    'repo sync' will not use authentication credentials from -u/-p or .netrc
    if the manifest server specified in the manifest file already includes
    credentials.
    
    The -f/--force-broken option can be used to proceed with syncing other
    projects if a project sync fails.
    
    The --force-sync option can be used to overwrite existing git
    directories if they have previously been linked to a different object
    direcotry. WARNING: This may cause data to be lost since refs may be
    removed when overwriting.
    
    The --no-clone-bundle option disables any attempt to use
    $URL/clone.bundle to bootstrap a new Git repository from a resumeable
    bundle file on a content delivery network. This may be necessary if
    there are problems with the local Python HTTP client or proxy
    configuration, but the Git binary works.
    
    The --fetch-submodules option enables fetching Git submodules of a
    project from server.
    
    The -c/--current-branch option can be used to only fetch objects that
    are on the branch specified by a project's revision.
    
    The --optimized-fetch option can be used to only fetch projects that are
    fixed to a sha1 revision if the sha1 revision does not already exist
    locally.
    
    The --prune option can be used to remove any refs that no longer exist
    on the remote.
    
    SSH Connections
    ---------------
    If at least one project remote URL uses an SSH connection (ssh://,
    git+ssh://, or user@host:path syntax) repo will automatically enable the
    SSH ControlMaster option when connecting to that host. This feature
    permits other projects in the same 'repo sync' session to reuse the same
    SSH tunnel, saving connection setup overheads.
    
    To disable this behavior on UNIX platforms, set the GIT_SSH environment
    variable to 'ssh'. For example:
    
      export GIT_SSH=ssh
      repo sync
    
      Compatibility
      ~~~~~~~~~~~~~
    This feature is automatically disabled on Windows, due to the lack of
    UNIX domain socket support.
    
    This feature is not compatible with url.insteadof rewrites in the user's
    ~/.gitconfig. 'repo sync' is currently not able to perform the rewrite
    early enough to establish the ControlMaster tunnel.
    
    If the remote SSH daemon is Gerrit Code Review, version 2.0.10 or later
    is required to fix a server side protocol bug.
    

    27. repo upload

    $ repo help upload
    
    Summary
    -------
    Upload changes for code review
    
    Usage: repo upload [--re --cc] [<project>]...
    
    Options:
      -h, --help            show this help message and exit
      -t                    Send local branch name to Gerrit Code Review
      --re=REVIEWERS, --reviewers=REVIEWERS
                            Request reviews from these people.
      --cc=CC               Also send email to these email addresses.
      --br=BRANCH           Branch to upload.
      --cbr, --current-branch
                            Upload current git branch.
      -d, --draft           If specified, upload as a draft.
      -D BRANCH, --destination=BRANCH, --dest=BRANCH
                            Submit for review on this target branch.
      --no-verify           Do not run the upload hook.
      --verify              Run the upload hook without prompting.
    
    Description
    -----------
    The 'repo upload' command is used to send changes to the Gerrit Code
    Review system. It searches for topic branches in local projects that
    have not yet been published for review. If multiple topic branches are
    found, 'repo upload' opens an editor to allow the user to select which
    branches to upload.
    
    'repo upload' searches for uploadable changes in all projects listed at
    the command line. Projects can be specified either by name, or by a
    relative or absolute path to the project's local directory. If no
    projects are specified, 'repo upload' will search for uploadable changes
    in all projects listed in the manifest.
    
    If the --reviewers or --cc options are passed, those emails are added to
    the respective list of users, and emails are sent to any new users.
    Users passed as --reviewers must already be registered with the code
    review system, or the upload will fail.
    
    Configuration
    -------------
    review.URL.autoupload:
    
    To disable the "Upload ... (y/N)?" prompt, you can set a per-project or
    global Git configuration option. If review.URL.autoupload is set to
    "true" then repo will assume you always answer "y" at the prompt, and
    will not prompt you further. If it is set to "false" then repo will
    assume you always answer "n", and will abort.
    
    review.URL.autoreviewer:
    
    To automatically append a user or mailing list to reviews, you can set a
    per-project or global Git option to do so.
    
    review.URL.autocopy:
    
    To automatically copy a user or mailing list to all uploaded reviews,
    you can set a per-project or global Git option to do so. Specifically,
    review.URL.autocopy can be set to a comma separated list of reviewers
    who you always want copied on all uploads with a non-empty --re
    argument.
    
    review.URL.username:
    
    Override the username used to connect to Gerrit Code Review. By default
    the local part of the email address is used.
    
    The URL must match the review URL listed in the manifest XML file, or in
    the .git/config within the project. For example:
    
      [remote "origin"]
        url = git://git.example.com/project.git
        review = http://review.example.com/
    
      [review "http://review.example.com/"]
        autoupload = true
        autocopy = johndoe@company.com,my-team-alias@company.com
    
    review.URL.uploadtopic:
    
    To add a topic branch whenever uploading a commit, you can set a
    per-project or global Git option to do so. If review.URL.uploadtopic is
    set to "true" then repo will assume you always want the equivalent of
    the -t option to the repo command. If unset or set to "false" then repo
    will make use of only the command line option.
    
    References
    ----------
    Gerrit Code Review: http://code.google.com/p/gerrit/
    

    28. repo version

    $ repo help version
    
    Summary
    -------
    Display the version of repo
    
    Usage: repo version
    
    Options:
      -h, --help  show this help message and exit
    

    2. 批量运行repo命令并抓取输出的脚本

    2.1 纯文本格式

    抓取所有的帮助信息并存放到文本文件中。

    在某个repo仓库的根目录下执行repo help cmd,并将所有命令输出到指定文件中,内容如下:

    #!/bin/bash
    
    out_file=$1
    
    $(rm -rf $out_file)
    
    cmds=$(repo help --all | grep -E "^ " | cut -d' ' -f3)
    
    for cmd in $cmds
    do
    	echo
    	echo "\$ repo help $cmd"
    	# echo # There's a new line here
    	echo "$(repo help $cmd)"
    	echo
    	echo "************************************************************************"
    done | tee -a $out_file
    
    echo done!
    

    执行的命令如下:

    op-tee/arm-v8$ ./repo-cmd-msg.sh repo-help.txt
    op-tee/arm-v8$ head -20 repo-help.txt
    
    $ repo help abandon
    
    Summary
    -------
    Permanently abandon a development branch
    
    Usage: repo abandon <branchname> [<project>...]
    
    This subcommand permanently abandons a development branch by
    deleting it (and all its history) from your local repository.
    
    It is equivalent to "git branch -D <branchname>".
    
    Options:
      -h, --help  show this help message and exit
    
    ************************************************************************
    

    2.2 Markdown格式

    Markdown格式添加了索引,点击索引命令到达命令帮助的详细信息,点击帮助信息的标题回到索引处。

    #!/bin/bash
    
    out_file=$1
    
    $(rm -rf $out_file)
    
    # 使用 "_write xxx" 代替 "echo xxx | tee -a $out_file"
    function _write()
    {
    	echo "$1" | tee -a $out_file
    }
    
    cmds=$(repo help --all | grep -E "^ " | cut -d' ' -f3)
    
    # 生成头部索引
    _write "<span id=\"__TOP\">索引</span>"
    i=1
    for cmd in $cmds
    do
    	_write "- [$i. repo $cmd](#__$cmd)"
    	i=$((i+1))
    done
    
    _write "---"
    
    # 生成详细内容
    i=1
    for cmd in $cmds
    do
    	_write "## <span id=\"__$cmd\">[$i. repo $cmd](#__TOP)</span>"
    	_write "\`\`\`"
    	_write "\$ repo help $cmd"
    	# _write ""
    	_write "$(repo help $cmd)"
    	_write "\`\`\`"
    	_write ""
    
    	i=$((i+1))
    done
    
    echo done!
    

    3. 联系和福利

    洛奇工作中常常会遇到自己不熟悉的问题,这些问题可能并不难,但因为不了解,找不到人帮忙而瞎折腾,往往导致浪费几天甚至更久的时间。

    所以我组建了两个微信讨论群(记得微信我说加哪个群,如何加微信见后面),欢迎加群一起讨论:

    • 一个Android OTA的讨论组,请说明加Android OTA群。
    • 一个git和repo的讨论组,请说明加git和repo群。

    在工作之余,洛奇尽量写一些对大家有用的东西,如果洛奇的这篇文章让您有所收获,解决了您一直以来未能解决的问题,不妨赞赏一下洛奇,这也是对洛奇付出的最大鼓励。扫下面的二维码赞赏洛奇,金额随意:
    赞赏
    洛奇自己维护了一个公众号“洛奇看世界”,一个关注程序员转型,提升认知的公众号,不定期更新。公号也提供个人联系方式,一些Andorid和GIT电子书资源,说不定会有意外的收获,详细内容见公号提示。扫下面的二维码关注公众号:
    公众号
    如果您觉得我想钱想疯了,或者套路公众号加粉,那请忽略以上文字,看看就好。我相信,如果您自己有做分享,有做公众号,那您会理解我的。
    谢谢!

    展开全文
  • reposync命令是一个python脚本。包含在yum-utils包中。因此,我们如果要使用reposync命令的时候,需要安装yum-utils包。使用以下命令:yum install yum-utilsreposync -r 仓库名(一般为base) -p 目标目录...

    reposync命令是一个python脚本。包含在yum-utils包中。

    因此,我们如果要使用reposync命令的时候,需要安装yum-utils包。

    使用以下命令:yum install yum-utils

    reposync -r 仓库名(一般为base) -p 目标目录

    展开全文
  • linux repo准备和代码下载

    千次阅读 2014-03-05 14:39:55
    【转】linux repo准备和代码下载 from http://hi.baidu.com/lizhengjun2010/blog/item/0b84aa406f2d579eb2b7dcf7.html 今天应公司要求,修改源码,重新定制Android系统! 呵呵...装了个熟悉的Ubuntu,首先还是把...

    【转】linux repo准备和代码下载

    from http://hi.baidu.com/lizhengjun2010/blog/item/0b84aa406f2d579eb2b7dcf7.html

    今天应公司要求,修改源码,重新定制Android系统!

    呵呵...装了个熟悉的Ubuntu,首先还是把系统弄炫的啦...

    下载源码吧!

    照着书上的下载源码的步骤做,结果错误n多啊!又百度又谷歌的...弄了一下午,终于开始下载啦!

    在这分享一下(部分网上copy的,呵呵...),希望大家少走弯路啊!

    1.安装git

    sudo apt-get install git-core

    2.安装curl

    sudo apt-get install git-core curl

    3.安装repo, 通过curl下载repo

    网上或者很多书籍上都是这样写的:

    curl http://android.git.kernel.org/repo > ~/bin/repo

    结果得到的repo不能用,什么301重定向的,唉!悲催啊!后来在csdn上发了个贴子,大牛给解决啦!

    http://code.google.com/p/git-repo/downloads/detail?name=repo-1.12 这个链接提供下载repo!

    也可以通过下面命令得到:

    curl http://git-repo.googlecode.com/files/repo-1.12 > ~/bin/repo

    4.修改执行权限

    chmod a+x ~/bin/repo

    5.修改~/bin/repo文件将第五行

    这一步又是容易出错啊,哥就死在这里很久啊!很多书籍或网站上都是这样命令:

    ~/bin/repo init -u git://android.git.kernel.org/platform/manifest.git

    执行以后,等n久,结果出现让你喜出望外的结果啊

    error:Failed connect to code.google.com:443; Operation now in progress while accessing https://code.google.com/p/git-repo//info/refs

    网上大牛解决:修改~/bin/repo文件将第五行

    REPO_URL='https://code.google.com/p/git-repo/'

    改为

    REPO_URL='http://code.google.com/p/git-repo/'

    6.然后向PATH中添加bin路径:

    export PATH=$PATH:~/bin

    7.新建一个目录,然后进入该目录。

    mkdir source

    cd source

    8.执行repo init -u git://Androidgit.linaro.org/platform/manifest.git -b android-2.3.4_r1

    这一步大概有一分多钟就完成了。

    9.修改.repo文件

    找到source目录中的.repo下面的manifest.xml文件,这是个隐藏文件 ls -a才能看到

    cd .repo

    gedit manifest.xml

    将fetch="git://Android.git.kernel.org/"

    改为

    fetch="git://Android.git.linaro.org/"

    10.执行repo sync

    OK,开始下载源码啦!鼓掌!!!呵呵....
    小弟也是新手,有什么错误的地方请指正,如有什么问题!留言吧!

    ————————————————————————

    我这边提示的错误是:

    /home/xxxxxx/bin/repo: line 1: 在未预料的“newline”附近出现语法错误
    /home/xxxxxx/bin/repo: line 1: `<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN

    按照上述的方法可解决

    展开全文
  • repo 常用命令

    2020-09-28 20:52:02
    最常用的repo命令: repo abandon xxx 删除xxx分支 repo branch 查看当前分支 repo branch 查看所有分支 repo checkout 切换分支 repo cherry-pick repo diff 显示提交树和工作树之间的更改 repo diffmanifests 清单...

    最常用的repo命令:
    repo abandon xxx 删除xxx分支
    repo branch 查看当前分支
    repo branch 查看所有分支
    repo checkout 切换分支
    repo cherry-pick
    repo diff 显示提交树和工作树之间的更改
    repo diffmanifests 清单差异
    repo download 下载并切换到
    repo grep 打印匹配的行模型
    repo info 获取有关的分支清单、当前分支或未合并的分支信息
    repo init 在当前目录中初始化repo
    repo list 列出项目及其相关联的目录
    repo overview 显示未合并项目分支的概述
    repo prune 删除已经合并的主题
    repo rebase 将本地分支重新建立在上游分支上
    repo smartsync 将工作树更新为最新的已知良好版本
    repo stage 提交的阶段文件
    repo start --all xxx 开始一个新的开发分支
    repo status 显示工作树的状态
    repo sync 将工作树更新为最新版本
    repo upload 上传更改以供代码审查

    展开全文
  • 转】linux repo准备和代码下载 from http://hi.baidu.com/lizhengjun2010/blog/item/0b84aa406f2d579eb2b7dcf7.html 设置本地源: #mount -o,loop /dev/sr0 /mnt vi /etc/yum....
  • linux 配置本地源repo yum常用命令

    千次阅读 2019-03-01 07:27:00
    1、进入目录 yum.repos.d [root@linux1 yum.repos.d]#...[root@linux1 yum.repos.d]# vi CentOS-Base.repo 把配置改为 [c7-media] name=local baseurl=file:///media/cdrom/ gpgcheck=1 enabled=1 yum ...
  • Linux 常用命令集合

    万次阅读 多人点赞 2021-04-03 14:41:02
    Linux 常用命令集合 一 基本知识了解 1.1 目录结构 /bin: 存放二进制可执行文件,常用命令一般都在这里 /etc: 存放系统管理和配置文件 /home: 存放所有用户文件的根目录,是用户主目录的基点 /usr: 用于存放...
  • 由于国内必须要翻墙才能从google下载repo命令,下面的连接是不用翻墙可以从其他地方下载到本命令的: 可以试试 curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo"> ~/bin/repo
  • Linux阿里云镜像repo.zip

    2021-03-18 10:52:46
    Linux阿里云镜像repo, 以及配置命令
  • 目录 自定义yum仓库:createrepo 自定义repo文件 使用yum命令安装httpd软件包 卸载httpd软件包:yum –y remove 软件名 清除yum缓存:yum clean all 使用yum查找软件包:yum search 软件包名 ...
  • Linux tee命令用于读取标准输入的数据,并将其内容输出成文件。 tee指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。 tee [-ai][--help][--version][文件...] 参数:
  • linuxrepo文件的配置

    万次阅读 2017-03-18 16:12:00
    首先我们需要说明,在linux下,repo文件都是存放在/etc/yum.repos.d文件夹之中的。repo文件即是我们常说的源文件(repositry匹配文件),在使用yum命令的时候系统会自动读取repo文件,然后去repositry获取软件。但是...
  • Linux ubuntu repo安装方法

    万次阅读 2019-03-25 20:31:30
    首先简单介绍一下repo是什么: repo是Android为了方便管理多个git库而开发的Python脚本。repo的出现,并非为了取代git,而是为了让Android开发者更为有效的利用... Android官方推荐下载repo的方法是通过Linux cur...
  • Linux终端命令

    千次阅读 2018-11-18 22:56:32
    Linux终端命令   1.终端命令的使用技巧 ctrl+shift+(+/=) 其实就是ctrl+“+” 放大终端界面字体; ctrl+- 缩小终端字体; tab 自动补全(注意,Linux是区分字母大小写的) ,双击tab的话,会根据你输入的首...
  • 今天刚回到家,在我的虚拟机上有安装了一个Linux系统,安装好之后,想要安装如下命令,yum install wget,yum install gcc,yum install vim,发现一个也没有安装成功,特别奇怪。我第一次安装Linux系统的时候,安装...
  • repo forall -c命令

    2020-11-20 23:47:58
    repo forall -c(command) 命令执行技巧 下载新分支 repo forall -c git checkout -b 本地分支名称(自定义) 服务器分支名称 切换到另一个分支 repo forall -c git checkout your_branch 删除分支 repo forall -c ...
  • Linux yum 命令

    千次阅读 2016-08-25 18:16:28
    概述yum( Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。...yum提供了查找、安装、删除某一个、一组甚至全部软件包的命令,而且命令简洁而又好记。语法yum [opt
  • Linux基础命令注释(一)

    千次阅读 2019-09-20 14:47:59
    Linux基础命令注释
  • Linux配置本地repo

    2021-04-27 19:17:43
    (1)进入repo文件,可以看到有很多CentOS文件,这里我不建议大家删掉,因为在以后的环境中可能需要用到这些,所以我们最好备份一下。 (2)创一个tom文件夹 把CentOS*等文件移到tom文件夹里 (3)用vi创一个后缀...
  • 1.执行repo命令的时候,总是显示“project xx no found” 解决: (1)先执行“repo forall -c pwd” 显示所有project的路径,按照这个来写project参数路径。 2.repo如何提交代码,参考:...
  • linux yum 命令

    万次阅读 2018-04-30 23:17:38
    linux yum 命令 yum( Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。 基於RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次...
  • repo拉取代码命令使用学习

    千次阅读 2020-12-07 11:34:16
    Android使用Git作为代码管理工具,开发了Gerrit进行代码审核以便更好的对代码进行集中式管理,还开发了Repo命令行工具,对Git部分命令封装,将百多个Git库有效的进行组织。 下载安装repo curl ...
  • 本人亲自总结的针对aliyun centos 7.2以上版本的常用的linux 操作命令,如有不明白的可到本人csdn账户里留言
  • repo的基本命令

    2014-01-20 11:29:16
    repo只是google用Python脚本写的调用git的一个脚本,主要是用来下载、管理Android项目的软件仓库。 下载 repo 的地址: http://android.git.kernel.org/repo ,可以用 wget ...
  • linux yum命令详解

    千次阅读 2016-06-21 12:17:51
    linux yum命令详解yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。基於RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且...
  • linux--Repo的介绍与安装

    万次阅读 2018-09-13 10:45:52
    1、Repo是由Android开发的命令行工具,对Git部分命令进行了封装,将百多个Git库有效的进行组织   二、安装 1、根目录下创建.bin文件夹 mkdir ~/.bin 2、配置为临时环境变量(也可配置为永久的) PATH=~/.bin:$...
  • 一、创建.bin文件夹 mkdir ~/.bin 二、把.bin文件夹加入环境变量 vim ~/.profile PATH更改一下内容: ...# set PATH so it ...三、下载repo工具 git clone https://github.com/NeutionWei/repo.git 四、修...
  • git使用:git/repo常用命令一览

    千次阅读 2015-04-21 18:07:27
    Git作为广受欢迎的一款版本控制工具,它该如何通过命令行使用呢?本文为你揭晓浓缩精华精华版:git常用命令一览,含部分repo操作。
  • Linux系统没有安装make命令,去执行make命令,会出现下面的错误 解决办法: #安装make命令命令 yum -y install gcc automake autoconf libtool make #查看是否安装成功(在Xshell下) make -v
  • Linux查找命令或组件对应安装包的方法当新搭建服务器或者维护不熟悉的服务器环境时,难免会碰到自己想用的命令或组件不存在的情况。如何通过包管理软件,方便地找到命令或组件对应的package进行安装?下面介绍三种...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 91,856
精华内容 36,742
关键字:

linuxrepo命令

linux 订阅