Skip to content

Commit

Permalink
8238918: idea.sh should work with both mercurial and git repos
Browse files Browse the repository at this point in the history
Reviewed-by: erikj, mcimadamore, ehelin, lancea
  • Loading branch information
Roger Riggs committed Feb 12, 2020
1 parent 411766b commit a239c47
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion bin/idea.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -113,6 +113,18 @@ if [ "x$SPEC" = "x" ] ; then
echo "FATAL: SPEC is empty" >&2; exit 1
fi

if [ -d "$TOPLEVEL_DIR/.hg" ] ; then
VCS_TYPE="hg4idea"
fi

if [ -d "$TOPLEVEL_DIR/.git" ] ; then
VCS_TYPE="Git"
fi

if [ "x$VCS_TYPE" = "x" ] ; then
echo "FATAL: VCS_TYPE is empty" >&2; exit 1
fi

### Replace template variables

NUM_REPLACEMENTS=0
Expand All @@ -137,6 +149,7 @@ add_replacement() {
}

add_replacement "###MODULE_NAMES###" "$MODULE_NAMES"
add_replacement "###VCS_TYPE###" "$VCS_TYPE"
SPEC_DIR=`dirname $SPEC`
if [ "x$CYGPATH" = "x" ]; then
add_replacement "###BUILD_DIR###" "$SPEC_DIR"
Expand Down
2 changes: 1 addition & 1 deletion make/idea/template/vcs.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="###ROOT_DIR###" vcs="hg4idea" />
<mapping directory="###ROOT_DIR###" vcs="###VCS_TYPE###" />
</component>
</project>

0 comments on commit a239c47

Please sign in to comment.