2

2 つのパッチを適用していますがgerrit、マージされていないパッチをマージされたパッチに依存させたいと考えています。

どちらもまだ gerrit にアップロードされています。

  • どうすればいいですか?それはまったく可能ですか?

  • 私はgerritを通してそれを行うことができますか? gitとcherry pickではありません。

https://gerrit.wikimedia.org/r/#/c/34106/がマージされていないファイルだとしましょう

マージされたファイルhttps://gerrit.wikimedia.org/r/#/c/25756/

4

2 に答える 2

4

Gerrit の依存関係は、Git ツリー グラフの単なる表現です。したがって、変更 B を変更 A に依存させるには、B は A を親として持つ必要があります。

あなたの場合、2 つの異なるリポジトリに 2 つの変更があります。リポジトリ間の依存関係は、現在 Gerrit ではサポートされていません。ただし、これは一般的に要求される機能であり、先週末の Gerrit ユーザー カンファレンスで議論されたばかりです。Gerrit の将来のバージョンでクロスリポジトリ依存関係のサポートが追加されることを願っています。

于 2012-11-20T04:33:17.660 に答える
2

hereから取得したgitコマンドを使用:

git fetch --all # Make sure we have latest info from the repository
git review -d 1234 # Gerrit change number of the change you want as dependency ("parent")

git checkout -b bug/1234 # Creates a new branch, with the current branch (the dependency) as parent
# Edit files: make your changes
git add someFile.php some/other/file.js 
git commit # Commit your patch

git log -n5 --decorate --pretty=oneline # Verify that the last 5 entries of the log now start with:
# * (HEAD, bug/1234) your change
# * (review/john/700) the dependency
# * (gerrit/master)

git push gerrit HEAD:refs/for/master # Use this instead of `git review`

git branch # Take note of the review/* branch that was created for this, it has an "*" in front of it
git checkout bug/1234 # Check out the local topic branch of your change
git rebase review/john/7000 # The branch name of the gerrit change we checked out earlier

# Resolve conflicts if needed,
# - use "git status" to see the files that need resolution
# - after fixing it in your editor, "git add filename" for each of the fixed files 

git commit --amend -c HEAD # Re-commit your patch replacing the one with the wrong parent

git log -n5 --decorate --pretty=oneline # Verify that the last 5 entries of the log now start with:
# * (HEAD, bug/1234) your change
# * (review/john/700) the dependency
# * (gerrit/master)

git push gerrit HEAD:refs/for/master # Use this instead of `git review`
于 2012-11-23T10:34:43.447 に答える