• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:branch

3 # Use of this source code is governed by a BSD-style license that can be
28 You need to be on a local branch tracking a remote one. `repo start` does this
31 $ git checkout -b mybranch --track origin/main
37 If you are tracking a different branch (e.g. aosp/main or cros/chromeos), the upload may
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"
53 curl = cmd("curl --silent --fail")
60 branch: str
67 def list_changes(cls, branch: str):
68 upstream = get_upstream(branch)
69 for line in git(f'log "--format=%H %s" --first-parent {upstream}..{branch}').lines():
75 msg = git("log -1 --format=email", self.sha).stdout()
76 match = re.search("^Change-Id: (I[a-f0-9]+)", msg, re.MULTILINE)
98 def get_upstream(branch: str = ""):
100 return git(f"rev-parse --abbrev-ref --symbolic-full-name {branch}@{{u}}").stdout()
106 return git("for-each-ref --format=%(refname:short) refs/heads").lines()
113 if confirm(f"You are not tracking an upstream branch. Set upstream to {default_upstream}?"):
114 git(f"branch --set-upstream-to {default_upstream}").fg()
117 raise Exception("You are not tracking an upstream branch.")
120 raise Exception(f"Your upstream branch '{upstream}' is not remote.")
125 if not git("remote get-url origin").success():
128 if git("remote get-url origin").stdout() != CROSVM_URL:
131 git("remote set-url origin", CROSVM_URL).fg()
136 hooks_dir = Path(git("rev-parse --git-path hooks").stdout())
137 hook_path = hooks_dir / "commit-msg"
140 curl(f"{GERRIT_URL}/tools/hooks/commit-msg").write_to(hook_path)
144 def print_branch_summary(branch: str):
145 upstream = get_upstream(branch)
147 print("Branch", branch, "is not tracking an upstream branch")
150 print("Branch", branch, "tracking", upstream)
151 changes = [*LocalChange.list_changes(branch)]
167 for branch in list_local_branches():
168 print_branch_summary(branch)
175 current_branch = git("branch --show-current").stdout()
177 branch
178 for branch in list_local_branches()
179 if branch != current_branch
180 and get_upstream(branch) is not None
182 change.status in ["ABANDONED", "MERGED"] for change in LocalChange.list_changes(branch)
191 for branch in branches_to_delete:
192 print_branch_summary(branch)
195 git("branch", "-D", *branches_to_delete).fg()
200 Rebases changes from the current branch onto origin/main.
202 Will create a new branch called 'current-branch'-upstream tracking origin/main. Changes from
203 the current branch will then be rebased into the -upstream branch.
205 branch_name = git("branch --show-current").stdout()
206 upstream_branch_name = branch_name + "-upstream"
208 if git("rev-parse", upstream_branch_name).success():
209 print(f"Overwriting existing branch {upstream_branch_name}")
210 git("log -n1", upstream_branch_name).fg()
212 git("fetch -q origin main").fg()
213 git("checkout -B", upstream_branch_name, "origin/main").fg()
215 print(f"Cherry-picking changes from {branch_name}")
216 git(f"cherry-pick {branch_name}@{{u}}..{branch_name}").fg()
227 Uploads changes to the crosvm main branch.
229 remote, branch = get_active_upstream()
244 if (remote, branch) != ("origin", "main"):
245 print(f"WARNING! Your changes are based on {remote}/{branch}, not origin/main.")
246 print("If gerrit rejects your changes, try `./tools/cl rebase -h`.")
254 extra_args.append("l=Auto-Submit+1")
257 extra_args.append("l=Commit-Queue+1")
259 extra_args.append(f"l=Commit-Queue+2")