[PATCH] D34376: git-llvm: Add a svn2git command.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 19 18:14:21 PDT 2017
pcc created this revision.
Lacks any sort of caching, but at least it's a start.
https://reviews.llvm.org/D34376
Files:
llvm/utils/git-svn/git-llvm
Index: llvm/utils/git-svn/git-llvm
===================================================================
--- llvm/utils/git-svn/git-llvm
+++ llvm/utils/git-svn/git-llvm
@@ -320,6 +320,16 @@
svn_push_one_rev(svn_root, r, dry_run)
+def cmd_svn2git(args):
+ '''Map svn revisions onto git revisions.'''
+ dot_git_dir = git('rev-parse', '--git-common-dir')
+ os.chdir(dot_git_dir)
+
+ # refs/notes/commits:09/c4/b68e68c4fcff64b00e1ac077c4f4a524cbcc
+ grep_result = git('grep', '-l', '^git-svn-rev: ' + args.rev + '$', 'refs/notes/commits')
+ print(grep_result.split(':')[1].replace('/', ''))
+
+
if __name__ == '__main__':
if not program_exists('svn'):
die('error: git-llvm needs svn command, but svn is not installed.')
@@ -357,6 +367,17 @@
'upstream, or not in origin/master if the branch lacks '
'an explicit upstream)')
parser_push.set_defaults(func=cmd_push)
+
+ parser_svn2git = subcommands.add_parser(
+ 'svn2git', description=cmd_svn2git.__doc__,
+ help='map svn revisions to git revisions')
+ parser_svn2git.add_argument(
+ 'rev',
+ metavar='SVN_REV',
+ type=str,
+ help="rev to map")
+ parser_svn2git.set_defaults(func=cmd_svn2git)
+
args = p.parse_args(argv)
VERBOSE = args.verbose
QUIET = args.quiet
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34376.103134.patch
Type: text/x-patch
Size: 1340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170620/187b7125/attachment.bin>
More information about the llvm-commits
mailing list