Explorar o código

Merge commit 'e4da410294ff4037a17e143899e36256b38fee18'

* commit 'e4da410294ff4037a17e143899e36256b38fee18':
  Adding minor usage and documentation
  Fixing potential bug in unlink-tools()
Samuel Jaffe %!s(int64=8) %!d(string=hai) anos
pai
achega
527c2b1804
Modificáronse 2 ficheiros con 14 adicións e 4 borrados
  1. 9 2
      profile-p4
  2. 5 2
      profile-util

+ 9 - 2
profile-p4

@@ -1,6 +1,7 @@
 export P4EDITOR="${EDITOR}"
 export P4DIFF="${EDITOR} -d"
 export P4MERGE="${EDITOR} -d"
+# May be overridden in ~/.profile-local or other such file
 : ${P4_MAIN_ROOT:="//depot/"}
 export P4_MAIN_ROOT
 
@@ -31,14 +32,19 @@ p4whose() {
 }
 
 p4backout() {
+  if [[ $# -lt 2 ]]; then
+    echo "usage: p4backout backout# parent#" >&2
+    return 1
+  fi
   local changenum="$1"
-  local target_stage="${2:-fdsparent}"
+  local target_stage="@${2}"
+  if [[ ${target_stage} == "@HEAD" ]]; then target_stage=""; fi
   local lastchange=$((changenum-1))
   p4 sync @$lastchange
   p4 edit ...
   p4 sync @$changenum
   p4 resolve -ay
-  p4 sync @$target_stage
+  p4 sync $target_stage
   p4 resolve -am
 }
 
@@ -52,6 +58,7 @@ p4_import_changelist() {
   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}")
   if [[ $has_view -eq 0 ]]
   then

+ 5 - 2
profile-util

@@ -9,6 +9,9 @@ fi
 
 alias reset-path="export PATH=\"$BASEPATH\""
 
+# Turn a number of symlink files into copies of their original
+# Usage: 
+#   detach file...
 detach() {
   for i; do [ -L "$i" ] && cp --remove-destination $(readlink "$i") "$i"; done
 }
@@ -21,8 +24,8 @@ link-tools() {
 }
 
 unlink-tools() {
-  PATH=$(echo $PATH | perl -pne "s/(?<=:)$HOME/tools.*://g")
-  LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | perl -pne "s/(?<=:)$HOME/tools.*://g")
+  PATH=$(echo $PATH | perl -pne "s/(?<=:)$HOME/tools.*?://g")
+  LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | perl -pne "s/(?<=:)$HOME/tools.*?://g")
   export PATH
   export LD_LIBRARY_PATH
 }