【Shell】【Gerrit】for循环之批量设置gerrit submit-type类型为REBASE_IF_NECESSARY

1.shell中for循环语法:

for L_PROJECT in $(ssh -p xxxx xxx.xxx.xxx gerrit ls-projects); do
    echo ${L_PROJECT}
    ssh -p xxxx xxx.xxx.xxx gerrit set-project ${L_PROJECT} --submit-type REBASE_IF_NECESSARY
done

2.gerrit ssh常用命令:

annie.wu@xxxx:~/work$ ssh -p xxxx xxx.xxx.xxx gerrit --help
gerrit [COMMAND] [ARG ...] [--] [--help (-h)]

 --          : end of options (default: false)
 --help (-h) : display this help text (default: true)

Available commands of gerrit are:

   apropos               Search in Gerrit documentation
   ban-commit            Ban a commit from a project's repository
   close-connection      Close the specified SSH connection
   convert-ref-storage   Convert ref storage to reftable (experimental)
   create-account        Create a new batch/role account
   create-branch         Create a new branch
   create-group          Create a new account group
   create-project        Create a new project and associated Git repository
   flush-caches          Flush some/all server caches from memory
   gc                    Run Git garbage collection
   index
   logging
   ls-groups             List groups visible to the caller
   ls-members            List the members of a given group
   ls-projects           List projects visible to the caller
   ls-user-refs          List refs visible to a specific user
   plugin
   query                 Query the change database
   receive-pack          Standard Git server side command for client side git push
   reload-config         Reloads the Gerrit configuration
   rename-group          Rename an account group
   review                Apply reviews to one or more patch sets
   sequence
   set-account           Change an account's settings
   set-head              Change HEAD reference for a project
   set-members           Modify members of specific group or number of groups
   set-project           Change a project's settings
   set-project-parent    Change the project permissions are inherited from
   set-reviewers         Add or remove reviewers on a change
   set-topic             Set the topic for one or more changes
   show-caches           Display current cache statistics
   show-connections      Display active client SSH connections
   show-queue            Display the background work queues
   stream-events         Monitor events occurring in real time
   test-submit
   version               Display gerrit version

See 'gerrit COMMAND --help' for more information.

3.gerrit set-project命令选项:

annie.wu@xxxx:~/work$ ssh -p xxxx xxx.xxx.xxx gerrit set-project --help
gerrit set-project NAME [--] [--change-id [TRUE | FALSE | INHERIT]] [--content-merge [TRUE | FALSE | INHERIT]] [--contributor-agreements [TRUE | FALSE | INHERIT]] [--description (-d) DESCRIPTION] [--help (-h)] [--max-object-size-limit VAL] [--no-change-id (--nid)] [--no-content-merge] [--no-contributor-agreements (--nca)] [--no-signed-off-by (--nso)] [--project-state (--ps) [ACTIVE | READ_ONLY | HIDDEN]] [--require-change-id (--id)] [--signed-off-by [TRUE | FALSE | INHERIT]] [--submit-type (-t) [INHERIT | FAST_FORWARD_ONLY | MERGE_IF_NECESSARY | REBASE_IF_NECESSARY | REBASE_ALWAYS | MERGE_ALWAYS | CHERRY_PICK]] [--trace] [--trace-id VAL] [--use-content-merge] [--use-contributor-agreements (--ca)] [--use-signed-off-by (--so)]

 NAME                                   : name of the project
 --                                     : end of options (default: false)
 --change-id [TRUE | FALSE | INHERIT]   : if change-id is required
 --content-merge [TRUE | FALSE |        : allow automatic conflict resolving
 INHERIT]                                 within files
 --contributor-agreements [TRUE |       : if contributor agreement is required
 FALSE | INHERIT]
 --description (-d) DESCRIPTION         : description of project
 --help (-h)                            : display this help text (default: true)
 --max-object-size-limit VAL            : max Git object size for this project
 --no-change-id (--nid)                 : if change-id is not required
 --no-content-merge                     : don't allow automatic conflict
                                          resolving within files
 --no-contributor-agreements (--nca)    : if contributor agreement is not
                                          required
 --no-signed-off-by (--nso)             : if signed-off-by is not required
 --project-state (--ps) [ACTIVE |       : project's visibility state
 READ_ONLY | HIDDEN]
 --require-change-id (--id)             : if change-id is required
 --signed-off-by [TRUE | FALSE |        : if signed-off-by is required
 INHERIT]
 --submit-type (-t) [INHERIT |          : project submit type
 FAST_FORWARD_ONLY | MERGE_IF_NECESSARY   (default: MERGE_IF_NECESSARY)
 | REBASE_IF_NECESSARY | REBASE_ALWAYS
 | MERGE_ALWAYS | CHERRY_PICK]
 --trace                                : enable request tracing (default:
                                          false)
 --trace-id VAL                         : trace ID (can only be set if --trace
                                          was set too)
 --use-content-merge                    : allow automatic conflict resolving
                                          within files
 --use-contributor-agreements (--ca)    : if contributor agreement is required
 --use-signed-off-by (--so)             : if signed-off-by is required

上一篇:炒黄金需要克服的不良心理


下一篇:.net 调用 nsfwjs 进行视频鉴别