Gerrit adding appkey and simply adding branches

Source: Internet
Author: User
Tags diff

Recently, the team is open to the Gerrit version of the project management tool, briefly talk about the Appkey configuration process

The first is to get the account password assigned by Gerrit. Then go to the homepage, if the new building should be no information, I have some information here to submit, and then find your account in the upper right corner, click on it, there is a Settings button, click to enter.

In the right there is a row of menu, click SSH Public Keys, will appear key information, add your current use of the device key, click on the Add key, the above key is I am currently using the device is bound

At this point you will be asked to fill in the location of the corresponding Key,key generally in the C:\Users\Administrator\.ssh directory, at this time there are 2 files Id_rsa,id_rsa, use the editor to open the Id_rsa file, copy key, and then paste the past, Create a known_hosts file at the same time

Then click Add, the server Host Key will appear, click the Copy button below, copy the Key, then paste it into the known_hosts file you just created, and the configuration is now ready to pull your git file normally.

Go to the corresponding directory and use the git clone command to pull the corresponding file

Test submit a file, first use the git add test.txt command to upload a file, and then use git commit-m ' comment ' to write a comment on this upload, and then use git status to see some of the status of the upload, the file is modified, deleted, or new, etc. At this point you will be prompted to enter your position and message name, the format of the system prompt to fill in your own account name and your corresponding message is OK

Then it was submitted, GIT push Origin head:refs/for/ Master. Commit to the corresponding branch, note that this is still an important point, there is a commit ID pairing problem, first open the directory you just pulled the project, in the system type open hidden file (open can be ignored), enter the. Git/hooks directory, create a commit-msg file, Write the code below, save it, and you can upload the code to Gerrit as usual.

#!/bin/sh
# from Gerrit Code Review 2.6
#
# part of Gerrit Code Review (http://code.google.com/p/gerrit/)
#
# Copyright (C) The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You are not a use of this file except in compliance with the License.
# Obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# unless required by applicable or agreed to writing, software
# Distributed under the License is distributed on a "as is" BASIS,
# without warranties or CONDITIONS of any KIND, either express or implied.
# See the License for the specific language governing permissions and
# Limitations under the License.
#

Unset grep_options

Change_id_after= "Bug| Issue "
Msg= "$"

# Check for, and add if missing, a unique Change-id
#
Add_changeid () {
Clean_message= ' Sed-e '
/^diff--git a\/.*/{
s///
Q
}
/^signed-off-by:/d
/^#/d
' $MSG ' | Git stripspace '
If Test-z "$clean _message"
Then
Return
Fi

# Does Change-id:already exist? If so, exit (NO).
If Grep-i ' ^change-id: ' "$MSG" >/dev/null
Then
Return
Fi

Id= ' _gen_changeid '
T= "$MSG. tmp.$$"
Awk=awk
if [-x/usr/xpg4/bin/awk]; Then
# Solaris AWK is just too broken
Awk=/usr/xpg4/bin/awk
Fi

# How this works:
#-Parse the commit message as (textline+ blankline*) *
#-Assume textline+ to be a footer until proven otherwise
#-exception:the First block isn't footer (as it is the title)
#-read textline+ into a variable
#-then Count Blanklines
#-Once the next textLine appears, print textline+ blankline* as these
# aren ' t footer
#-In END, the last textline+ block was available for footer parsing
$AWK '
BEGIN {
# While we start with the assumption that textline+
# is a footer, the first block was not.
Isfooter = 0
footercomment = 0
Blanklines = 0
}

# Skip lines starting with ' # ' without any spaces before it.
/^#/{Next}

# Skip the line starting with the diff command and everything after it,
# up to the end of the file, assuming it's only patch data.
# If more than one line before the diff is empty, strip all but one.
/^diff--git A/{
Blanklines = 0
while (getline) {}
Next
}

# Count Blank lines outside footer comments
/^$/&& (footercomment = = 0) {
blanklines++
Next
}

# Catch Footer Comment
/^\[[a-za-z0-9-]+:/&& (Isfooter = = 1) {
Footercomment = 1
}

/]$/&& (footercomment = = 1) {
Footercomment = 2
}

# We have a non-blank line after blank lines. Handle this.
(Blanklines > 0) {
Print lines
for (i = 0; i < blanklines; i++) {
Print ""
}

Lines = ""
Blanklines = 0
Isfooter = 1
footercomment = 0
}

# Detect that the current block was not the footer
(footercomment = = 0) && (!/^\[?[ a-za-z0-9-]+:/| | /^[a-za-z0-9-]+:\/\//) {
Isfooter = 0
}

{
# We need this information on the current last comment line
if (footercomment = = 2) {
footercomment = 0
}
if (lines! = "") {
lines = lines "\ n";
}
lines = lines
}

# Footer Handling:
# If the last block was considered a footer, splice in the Change-id at the
# right place.
# Look for the inject Change-id by considering
# Change_id_after. Keys listed in it (case insensitive) come first,
# then Change-id and then everything else (eg. Signed-off-by:).
#
# Otherwise Just print the last block, a new line and the Change-id as a
# block of its own.
END {
unprinted = 1
if (Isfooter = = 0) {
Print lines "\ n"
Lines = ""
}
Changeidafter = "^ (" ToLower ("'" $CHANGE _id_after "'") "):"
Numlines = Split (lines, footer, "\ n")
for (line = 1, line <= numlines; line++) {
if (unprinted && match (ToLower (footer[line)), changeidafter)! = 1) {
unprinted = 0
print "Change-id:i '" $id "'"
}
Print Footer[line]
}
if (unprinted) {
print "Change-id:i '" $id "'"
}
} ' $MSG > $T && mv $T "$MSG" | | Rm-f "$T"
}
_gen_changeidinput () {
echo "Tree ' git write-tree '"
If parent= ' git rev-parse "head^0" 2>/dev/null '
Then
echo "Parent $parent"
Fi
echo "Author ' git var git_author_ident '"
echo "Committer ' git var git_committer_ident '"
Echo
printf '%s ' "$clean _message"
}
_gen_changeid () {
_gen_changeidinput |
Git hash-object-t commit--stdin
}

Add_changeid

Gerrit adding appkey and simply adding branches

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.