Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F11033137
D66395.diff
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Dec 12, 12:56 PM
Size
2 KB
Mime Type
text/x-patch; charset=utf-8
Expires
Fri, Dec 13, 12:56 PM (23 h, 59 m)
Engine
blob
Format
Raw Data
Handle
6199166
Attached To
D66395: [util] Add check to git-llvm to avoid pushing to a non-trunk branch
D66395.diff
View Options
Index: llvm/utils/git-svn/git-llvm
===================================================================
--- llvm/utils/git-svn/git-llvm
+++ llvm/utils/git-svn/git-llvm
@@ -44,9 +44,11 @@
# Python 2
from pipes import quote
+LLVM_MONOREPO_DIR = '/trunk'
+
# It's *almost* a straightforward mapping from the monorepo to svn...
LLVM_MONOREPO_SVN_MAPPING = {
- d: (d + '/trunk')
+ d: (d + LLVM_MONOREPO_DIR)
for d in [
'clang-tools-extra',
'compiler-rt',
@@ -67,10 +69,10 @@
'pstl',
]
}
-LLVM_MONOREPO_SVN_MAPPING.update({'clang': 'cfe/trunk'})
-LLVM_MONOREPO_SVN_MAPPING.update({'': 'monorepo-root/trunk'})
+LLVM_MONOREPO_SVN_MAPPING.update({'clang': 'cfe' + LLVM_MONOREPO_DIR})
+LLVM_MONOREPO_SVN_MAPPING.update({'': 'monorepo-root' + LLVM_MONOREPO_DIR})
-SPLIT_REPO_NAMES = {'llvm-' + d: d + '/trunk'
+SPLIT_REPO_NAMES = {'llvm-' + d: d + LLVM_MONOREPO_DIR
for d in ['www', 'zorg', 'test-suite', 'lnt']}
VERBOSE = False
@@ -430,6 +432,11 @@
Note: a current limitation is that git does not track file rename, so they
will show up in SVN as delete+add.
'''
+
+ # Check for the branch.
+ if LLVM_MONOREPO_DIR != '/trunk' and not args.force_branch:
+ die("Branch is not trunk (specify --force-branch to override)")
+
# Get the git root
git_root = git('rev-parse', '--show-toplevel')
if not os.path.isdir(git_root):
@@ -543,6 +550,10 @@
populates the git commit message with both the SVN revision and git hash of
the change being reverted.'''
+ # Check for the branch.
+ if LLVM_MONOREPO_DIR != '/trunk' and not args.force_branch:
+ die("Branch is not trunk (specify --force-branch to override)")
+
# Get the git root
git_root = git('rev-parse', '--show-toplevel')
if not os.path.isdir(git_root):
@@ -626,6 +637,11 @@
help='Do everything other than commit to svn. Leaves junk in the svn '
'repo, so probably will not work well if you try to commit more '
'than one rev.')
+ parser_push.add_argument(
+ '--force-branch',
+ dest='force_branch',
+ action='store_true',
+ help='Force pushing to a non-trunk branch.')
parser_push.add_argument(
'rev_range',
metavar='GIT_REVS',
@@ -651,6 +667,11 @@
action='store_true',
help='Do everything other than perform a revert. Prints the git '
'revert command it would have run.')
+ parser_revert.add_argument(
+ '--force-branch',
+ dest='force_branch',
+ action='store_true',
+ help='Force reverting a commit on a non-trunk branch.')
parser_revert.set_defaults(func=cmd_revert)
parser_svn_lookup = subcommands.add_parser(
Event Timeline
Log In to Comment