2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
14 ##########################################################################################################################
16 ### Purpose: To describe whether the directory specified has the old directory format or the new directory format
17 ### Usage: This function takes one argument: The directory in question
18 ### It will set the temporary variable BRANCH_FORMAT. This variable can change with every call, so it is up to the user to
19 ### store it into something else as soon as the function exists
21 ### > isNewFormat ./myDevDir/testing/branch/hbase
24 echo "Determining if directory $1 is of the 0.94 and before OR 0.95 and after versions";
25 if [[ "$1" = "" ]]; then
26 echo "Directory not specified. Exiting";
28 echo "First, check that $1 exists";
30 echo "Directory $1 exists"
32 echo "Directory $1 does not exist. Exiting";
36 if [[ -d "$1/hbase-server" ]]; then
38 echo "The directory $1/hbase-server exists so this is of the new format";
39 export BRANCH_FORMAT
=new
;
42 echo "The directory $1/hbase-server does not exist. Therefore, this is of the old format";
43 export BRANCH_FORMAT
=old
;
47 ### Purpose: To describe whether the argument specified is a git repo or a local directory
48 ### Usage: This function takes one argument: The directory in question
49 ### It will set the temporary variable INPUT_FORMAT. This variable can change with every call, so it is up to the user to
50 ### store it into something else as soon as the function exists
52 ### > isGitRepo ./myDevDir/testing/branch/hbase
56 echo "Determining if this is a local directory or a git repo.";
57 if [[ "$1" = "" ]]; then
58 echo "No value specified for repo or directory. Exiting."
62 if [[ `echo $1 | grep 'http://'` ||
`echo $1 | grep 'https://'` ||
`echo $1 | grep 'git://'` ]]; then
63 echo "Looks like $1 is a git repo";
64 export INPUT_FORMAT
=git_repo
66 echo "$1 is a local directory";
67 export INPUT_FORMAT
=local_directory