Lines Matching +full:- +full:- +full:set +full:- +full:upstream
3 # Use of this source code is governed by a BSD-style license that can be
20 Upload changes to the upstream crosvm gerrit.
25 This tool allows developers to send commits to the upstream gerrit review site
31 $ git checkout -b mybranch --track origin/main
39 create a new branch tracking origin/main and cherry-picks your commits.
42 [mybranch-upstream] ... resolve conflicts
43 [mybranch-upstream] $ git add .
44 [mybranch-upstream] $ git cherry-pick --continue
45 [mybranch-upstream] $ ./tools/cl upload
49 GERRIT_URL = "https://chromium-review.googlesource.com"
54 curl = cmd("curl --silent --fail")
69 upstream = get_upstream(branch)
70 for line in git(f'log "--format=%H %s" --first-parent {upstream}..{branch}').lines():
76 msg = git("log -1 --format=email", self.sha).stdout()
77 match = re.search("^Change-Id: (I[a-f0-9]+)", msg, re.MULTILINE)
101 return git(f"rev-parse --abbrev-ref --symbolic-full-name {branch}@{{u}}").stdout()
107 return git("for-each-ref --format=%(refname:short) refs/heads").lines()
111 upstream = get_upstream()
112 if not upstream:
114 if confirm(f"You are not tracking an upstream branch. Set upstream to {default_upstream}?"):
115 git(f"branch --set-upstream-to {default_upstream}").fg()
116 upstream = get_upstream()
117 if not upstream:
118 raise Exception("You are not tracking an upstream branch.")
119 parts = upstream.split("/")
121 raise Exception(f"Your upstream branch '{upstream}' is not remote.")
126 if not git("remote get-url origin").success():
129 if git("remote get-url origin").stdout() not in [CROSVM_URL, CROSVM_SSO]:
132 git("remote set-url origin", CROSVM_URL).fg()
137 hooks_dir = Path(git("rev-parse --git-path hooks").stdout())
138 hook_path = hooks_dir / "commit-msg"
141 curl(f"{GERRIT_URL}/tools/hooks/commit-msg").write_to(hook_path)
146 upstream = get_upstream(branch)
147 if not upstream:
148 print("Branch", branch, "is not tracking an upstream branch")
151 print("Branch", branch, "tracking", upstream)
176 current_branch = git("branch --show-current").stdout()
196 git("branch", "-D", *branches_to_delete).fg()
203 Will create a new branch called 'current-branch'-upstream tracking origin/main. Changes from
204 the current branch will then be rebased into the -upstream branch.
206 branch_name = git("branch --show-current").stdout()
207 upstream_branch_name = branch_name + "-upstream"
209 if git("rev-parse", upstream_branch_name).success():
211 git("log -n1", upstream_branch_name).fg()
213 git("fetch -q origin main").fg()
214 git("checkout -B", upstream_branch_name, "origin/main").fg()
216 print(f"Cherry-picking changes from {branch_name}")
217 git(f"cherry-pick {branch_name}@{{u}}..{branch_name}").fg()
247 print("If gerrit rejects your changes, try `./tools/cl rebase -h`.")
255 extra_args.append("l=Auto-Submit+1")
258 extra_args.append("l=Commit-Queue+1")
260 extra_args.append(f"l=Commit-Queue+2")