All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
make_patch.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 # Implement the suggestion here:
4 # http://blog.neutrino.es/2012/git-copy-a-file-or-directory-from-another-repository-preserving-history/
5 # Note that if the file was moved, you only get history since the move.
6 
8 {
9  echo "USAGE: `basename ${0}` <repository> <file or directory>"
10 }
11 
13 {
14  ( cd / ; /bin/pwd -P ) >/dev/null 2>&1
15  if (( $? == 0 )); then
16  pwd_P_arg="-P"
17  fi
18  reldir=`dirname ${0}`
19  thisdir=`cd ${reldir} && /bin/pwd ${pwd_P_arg}`
20 }
21 
22 repo=${1}
23 myfile=${2}
24 
25 if [ -z ${repo} ]; then
26  usage
27  exit 1
28 fi
29 if [ -z ${myfile} ]; then
30  usage
31  exit 1
32 fi
33 
34 currentdir=`pwd`
36 echo " script directory: ${thisdir}"
37 echo " current directory: ${currentdir}"
38 
39 patchdir=${currentdir}/${repo}patch
40 mkdir -p ${patchdir}
41 cd ${currentdir}/${repo}
42 reposrc=${myfile}
43 git format-patch -o ${patchdir} $(git log ${reposrc}|grep ^commit|tail -1|awk '{print $2}')^..HEAD ${reposrc}
44 
45 echo
46 echo "Patch files have been created in ${patchdir}"
47 echo "cd <destination repository>"
48 echo "git am ${patchdir}/*.patch"
49 echo
50 
51 exit 0
52 
process_name opflash particleana ie ie ie z
static std::string format(PyObject *obj, unsigned int pos, unsigned int indent, unsigned int maxlen, unsigned int depth)
Definition: fclmodule.cxx:374
pdgs p
Definition: selectors.fcl:22
usage
Definition: doGit.sh:21
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
repo
Definition: make_patch.sh:22
then shift fi
do cd
get_this_dir()
Definition: grid_setup.sh:14