diff options
| author | Doug Anderson <dianders@google.com> | 2011-04-07 11:46:59 -0700 |
|---|---|---|
| committer | Shawn O. Pearce <sop@google.com> | 2011-04-07 16:49:23 -0400 |
| commit | dafb1d68d33137779c96a83c7e42cac0e7a27ca4 (patch) | |
| tree | e0e3c93d316c8cdf48a15fec97c458b391a6039e /project.py | |
| parent | 4655e81a75f2ea5f1eaf93de1249886171281e61 (diff) | |
| download | git-repo-dafb1d68d33137779c96a83c7e42cac0e7a27ca4.tar.gz | |
Fixed repo abandon to give better messages.
The main fix is to give an error message if nothing was actually
abandoned. See <http://crosbug.com/6041>.
The secondary fix is to list projects where the abandon happened.
This could be done in a separate CL or dropped altogether if requested.
TEST=manual
$ repo abandon dougabc; echo $?
Abandon dougabc: 100% (127/127), done.
Abandoned in 2 project(s):
chromite
src/platform/init
0
$ repo abandon dougabc; echo $?
Abandon dougabc: 100% (127/127), done.
error: no project has branch dougabc
1
$ repo abandon dougabc; echo $?
Abandon dougabc: 100% (127/127), done.
error: chromite/: cannot abandon dougabc
1
Change-Id: I79520cc3279291acadc1a24ca34a761e9de04ed4
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 12 |
1 files changed, 9 insertions, 3 deletions
| @@ -1204,13 +1204,19 @@ class Project(object): | |||
| 1204 | 1204 | ||
| 1205 | def AbandonBranch(self, name): | 1205 | def AbandonBranch(self, name): |
| 1206 | """Destroy a local topic branch. | 1206 | """Destroy a local topic branch. |
| 1207 | |||
| 1208 | Args: | ||
| 1209 | name: The name of the branch to abandon. | ||
| 1210 | |||
| 1211 | Returns: | ||
| 1212 | True if the abandon succeeded; False if it didn't; None if the branch | ||
| 1213 | didn't exist. | ||
| 1207 | """ | 1214 | """ |
| 1208 | rev = R_HEADS + name | 1215 | rev = R_HEADS + name |
| 1209 | all = self.bare_ref.all | 1216 | all = self.bare_ref.all |
| 1210 | if rev not in all: | 1217 | if rev not in all: |
| 1211 | # Doesn't exist; assume already abandoned. | 1218 | # Doesn't exist |
| 1212 | # | 1219 | return None |
| 1213 | return True | ||
| 1214 | 1220 | ||
| 1215 | head = self.work_git.GetHead() | 1221 | head = self.work_git.GetHead() |
| 1216 | if head == rev: | 1222 | if head == rev: |
