diff options
author | Shawn O. Pearce <sop@google.com> | 2008-11-03 11:24:59 -0800 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2008-11-03 11:24:59 -0800 |
commit | 9fa44db94bfabcf43160316660801a2c1db2dbb9 (patch) | |
tree | 4a8ffcba60cfd6c02e88c9f401a66d4cab1b18b0 /subcmds/abandon.py | |
parent | c9ef744c7b5f6bcab446cf0a0bc9cc1b016dd5f8 (diff) | |
download | git-repo-9fa44db94bfabcf43160316660801a2c1db2dbb9.tar.gz |
Introduce 'repo abandon <branchname>' as an alias for 'git branch -D'v1.0.9
This destroys a local development branch, removing all history
of that branch from ever existing. If the branch is currently
checked out we move back to the upstream revision.
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'subcmds/abandon.py')
-rw-r--r-- | subcmds/abandon.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/subcmds/abandon.py b/subcmds/abandon.py new file mode 100644 index 00000000..4f976d7b --- /dev/null +++ b/subcmds/abandon.py | |||
@@ -0,0 +1,42 @@ | |||
1 | # | ||
2 | # Copyright (C) 2008 The Android Open Source Project | ||
3 | # | ||
4 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | # you may not use this file except in compliance with the License. | ||
6 | # You may obtain a copy of the License at | ||
7 | # | ||
8 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | # | ||
10 | # Unless required by applicable law or agreed to in writing, software | ||
11 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | # See the License for the specific language governing permissions and | ||
14 | # limitations under the License. | ||
15 | |||
16 | import sys | ||
17 | from command import Command | ||
18 | from git_command import git | ||
19 | |||
20 | class Abandon(Command): | ||
21 | common = True | ||
22 | helpSummary = "Permanently abandon a development branch" | ||
23 | helpUsage = """ | ||
24 | %prog <branchname> [<project>...] | ||
25 | |||
26 | This subcommand permanently abandons a development branch by | ||
27 | deleting it (and all its history) from your local repository. | ||
28 | |||
29 | It is equivalent to "git branch -D <branchname>". | ||
30 | """ | ||
31 | |||
32 | def Execute(self, opt, args): | ||
33 | if not args: | ||
34 | self.Usage() | ||
35 | |||
36 | nb = args[0] | ||
37 | if not git.check_ref_format('heads/%s' % nb): | ||
38 | print >>sys.stderr, "error: '%s' is not a valid name" % nb | ||
39 | sys.exit(1) | ||
40 | |||
41 | for project in self.GetProjects(args[1:]): | ||
42 | project.AbandonBranch(nb) | ||