about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-09-27 11:17:43 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-09-27 11:17:43 +0000
commitdb7e23754d3bdf97ea8a3792ae071b47406ea027 (patch)
tree3f3bd2800fdf6b35a0cdb0e213deba35217cedd2
parent31ce8d6560b111edb96f2fe6d8902e0b8a472099 (diff)
downloadzsh-db7e23754d3bdf97ea8a3792ae071b47406ea027.tar.gz
zsh-db7e23754d3bdf97ea8a3792ae071b47406ea027.tar.xz
zsh-db7e23754d3bdf97ea8a3792ae071b47406ea027.zip
unposted: improve p4 add to ignore files being added already
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Unix/Command/_perforce8
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 53fdbaa5a..5267b1893 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-09-27  Peter Stephenson  <pws@csr.com>
+
+	* unposted: Completion/Unix/Command/_perforce: when adding
+	files, ignore files already open for whatever reason,
+	including those already being added.
+
 2004-09-24  Wayne Davison  <wayned@users.sourceforge.net>
 
 	* 20409: Completion/Unix/Command/_darcs: Completion for the darcs
diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce
index 13c247183..4fdd4bacf 100644
--- a/Completion/Unix/Command/_perforce
+++ b/Completion/Unix/Command/_perforce
@@ -378,7 +378,9 @@ _perforce() {
 #
 
 # Front end to _call_program to add in the global arguments
-# passed to p4.
+# passed to p4.  The first argument is the tag, the remaining
+# arguments are passed to p4.  Typically the tag is the same
+# as the first p4 argument.
 (( $+functions[_perforce_call_p4] )) ||
 _perforce_call_p4() {
   local cp_tag=$1
@@ -987,8 +989,12 @@ _perforce_files() {
     : ${PREFIX:#(#b)(*/)(*)}
     pfx="$match[1]"
     pfx=${(e)~pfx}
+    # Exclude both files already known to perforce, plus
+    # those opened.  There will be some overlap but we need
+    # to exclude files that are already opened for add.
     omitpats=(
       ${${${${(f)"$(_perforce_call_p4 files files \"\$pfx\*\$\{\(Q\)SUFFIX\}\" 2>/dev/null)"}%\#*}##*/}//(#m)[][*?()<|^~#\\]/\\$MATCH}
+      ${${${${(f)"$(_perforce_call_p4 opened opened \"\$pfx\*\$\{\(Q\)SUFFIX\}\" 2>/dev/null)"}%\#*}##*/}//(#m)[][*?()<|^~#\\]/\\$MATCH}
 	)
 
     [[ $#omitpats -eq 1 && $omitpats[1] = '' ]] && omitpats=()