Parcourir la source

Adding p4_import_client

Sam Jaffe il y a 6 ans
Parent
commit
e23be2f8a1
1 fichiers modifiés avec 13 ajouts et 3 suppressions
  1. 13 3
      profile-p4

+ 13 - 3
profile-p4

@@ -52,15 +52,13 @@ p4backout() {
   p4 resolve -am
 }
 
-p4_import_changelist() {
-  local changelist="${1}"
+_p4_import_impl() {
   local tmpfile=$(mktemp)
   trap "rm -f ${tmpfile}" EXIT
 
   p4 client -o > "${tmpfile}"
 
   local client=$(grep -E "^Client:" "${tmpfile}" | awk '{ print $2 }')
-  local files=($(IFS=$'\n'; p4 describe -s "${changelist}" | grep -E "^\.\.\." | cut -d' ' -f2- | cut -d'#' -f1))
 
   # Initialize the client if necessary (a client with no files in view will not always have a View header)
   local has_view=$(grep -c -E "^View:" "${tmpfile}")
@@ -78,6 +76,18 @@ p4_import_changelist() {
   p4 client -i < "${tmpfile}"
 }
 
+p4_import_client() {
+  local other_client="${1}"
+  local files=($(IFS=$'\n'; p4 client -o "${other_client}" | sed -n '/^View:$/ { :a; n; p; ba; }' | cut -d' ' -f1 | tr -d $'\t'))
+  _p4_import_impl
+}
+
+p4_import_changelist() {
+  local changelist="${1}"
+  local files=($(IFS=$'\n'; p4 describe -s "${changelist}" | grep -E "^\.\.\." | cut -d' ' -f2- | cut -d'#' -f1))
+  _p4_import_impl
+}
+
 p4finish() { 
   local rmdir=0 force=0 good=1
   if [[ ${1} == "-d" ]]; then rmdir=1; shift; fi