1. xemacs
  2. clearcase

Commits

mdiers  committed eb6f235

Cygwin issues. Path conversions, 'ct lsco' output, temp file cleanup.

Submitted by:
Steven E. Harris <seh@speakeasy.org>

References:
http://list-archive.xemacs.org/xemacs-patches/200201/msg00169.html

  • Participants
  • Parent commits a74eac7
  • Branches default

Comments (0)

Files changed (1)

File clearcase.el

View file
   (let* ((checkout-list nil)
          (directory default-directory)
          subdir
-         fullpath)
+         subdir-native
+         filename
+         fullpath-native)
 
     ;; Iterate over each line in the buffer.
     ;;
     ;;   2. Since this is called from dired-after-reading-hook, it can get
     ;;      called on a single-line buffer. In this case there is no subdir,
     ;;      and no checkout-list. We need to call clearcase-fprop-checked-out
-    ;;      to text for a checkout.
+    ;;      to test for a checkout.
     ;;
     (save-excursion
       (goto-char (point-min))
          ;; Case 1: Look for directory markers
          ;;
          ((setq subdir (dired-get-subdir))
-            
+
+          (setq subdir-native (clearcase-path-canonicalise-slashes
+                               (clearcase-path-native subdir)))
+
           ;; We're at a subdirectory line in the dired buffer.
           ;; Go and list all checkouts in this subdirectory.
           ;;
          
          ;; Case 2: Look for files (the safest way to get the filename).
          ;;
-         ((setq fullpath (dired-get-filename nil t))
-          
+         ((setq filename (dired-get-filename 'no-dir t))
+
           ;; Expand it to get rid of . and .. entries.
           ;;
-          (setq fullpath (expand-file-name fullpath))
-          
+          (setq fullpath-native (concat subdir-native filename))
+
           ;; Only modify directory listings of the correct format.
           ;; We replace the GID field with a checkout indicator.
           ;;
                      (replacement-length (- replacement-end replacement-begin))
                      (replacement-text (format "CHECKOUT"))
                      (is-checkout (if checkout-list
-                                      (member fullpath checkout-list)
-                                    (clearcase-fprop-checked-out fullpath))))
-                
+                                      (member fullpath-native checkout-list)
+                                    (clearcase-fprop-checked-out (expand-file-name filename)))))
+
                 ;; Highlight the line if the file is checked-out.
                 ;;
                 (if is-checkout
                                                      32))))
                       (goto-char replacement-begin)
                       (delete-char replacement-length)
-                      (insert (substring replacement-text 0 replacement-length)))
-                  
-                  ;; Highlight the checked out files.
-                  ;;
-                  (if (fboundp 'put-text-property)
-                      (let ((buffer-read-only nil))
-                        (put-text-property replacement-begin replacement-end
-                                           'face 'clearcase-dired-checkedout-face)))
-                  )))))
-        (forward-line 1))))
-  (message "Reformatting...Done"))
+                      (insert (substring replacement-text 0 replacement-length))
+
+                      ;; Highlight the checked out files.
+                      ;;
+                      (if (fboundp 'put-text-property)
+                          (put-text-property replacement-begin replacement-end
+                                             'face 'clearcase-dired-checkedout-face))))
+                ))))
+        (forward-line 1)))
+  (message "Reformatting...Done")))
 
 (defun clearcase-dired-list-checkouts (directory)
   "Returns a list of files checked-out to the current view in DIRECTORY."
              (cmd (list
                    "lsco" "-cview" "-fmt"
                    (if clearcase-on-mswindows
-		       "%n\\n"
+                       (if clearcase-xemacs-p
+                           "%n\n"
+                         "%n\\n")
                      "'%n\\n'")
                    
                    ;; Give the directory as an argument so all names will be
     (start-process-shell-command "Diff"
                                  nil
                                  applet-name
-                                 other-file
-                                 truename)))
+                                 (clearcase-path-canonicalise-slashes (clearcase-path-native other-file))
+                                 (clearcase-path-canonicalise-slashes (clearcase-path-native truename)))))
 
 ;;}}}
 
                                                     other-version)))
     (if (clearcase-file-is-in-mvfs-p truename)
         (clearcase-diff-files other-vxpath truename)
-      (clearcase-diff-files (clearcase-vxpath-get-version-in-temp-file other-vxpath)
-                            truename))))
+      (let ((temp-file (clearcase-vxpath-get-version-in-temp-file other-vxpath)))
+        (clearcase-diff-files temp-file truename)
+        (delete-file temp-file)))))
 
 ;;}}}
 
     (start-process-shell-command "Vtree_browser"
                                  nil
                                  applet-name
-                                 file)))
+                                 (clearcase-path-canonicalise-slashes
+                                  (clearcase-path-native file)))))
 
 ;;}}}
 
 
 (defun clearcase-diff-files (file1 file2)
   "Run cleardiff on FILE1 and FILE2 and display the differences."
-  (if clearcase-use-normal-diff
-      (clearcase-do-command 2 clearcase-normal-diff-program file2 clearcase-normal-diff-switches file1)
-    (clearcase-do-command 2 "cleardiff" file2 "-diff_format" file1))
-  (let ((diff-size  (save-excursion
-                      (set-buffer "*clearcase*")
-                      (buffer-size))))
-    (if (zerop diff-size)
-        (message "No differences")
-      (clearcase-port-view-buffer-other-window "*clearcase*")
-      (goto-char 0)
-      (shrink-window-if-larger-than-buffer))))
+  ;; Fix `file1' path since it's passed as a fully-qualified argument
+  ;; to the command. `file2' will be split into path and base name
+  ;; parts in `clearcase-do-command' which works correctly whether the
+  ;; path is native or not. If we do decide that `file2' should also
+  ;; be fixed up, the rigtht place is probably within
+  ;; `clearcase-do-command' as `file2' becomes the one known file
+  ;; argument there.
+  (let ((file1 (clearcase-path-native file1)))
+    (if clearcase-use-normal-diff
+        (clearcase-do-command 2 clearcase-normal-diff-program file2 clearcase-normal-diff-switches file1)
+      (clearcase-do-command 2 "cleardiff" file2 "-diff_format" file1))
+    (let ((diff-size (save-excursion
+                       (set-buffer "*clearcase*")
+                       (buffer-size))))
+      (if (zerop diff-size)
+          (message "No differences")
+        (clearcase-port-view-buffer-other-window "*clearcase*")
+        (goto-char 0)
+        (shrink-window-if-larger-than-buffer)))))
 
 ;;}}}
 
                              clearcase-fprop-hashtable)))
 
 (defun clearcase-fprop-get-properties (file)
-  "For FILE, make sure it's ClearCase properties are in the hashtable
+  "For FILE, make sure its ClearCase properties are in the hashtable
 and then return them."
   (or (clearcase-fprop-lookup-properties file)
       (let ((properties
          (predecessor (clearcase-fprop-predecessor-version file))
          (default-filename (clearcase-vxpath-cons-vxpath file predecessor))
 
-         ;; To get this too work it is necessary to make Emacs think
+         ;; To get this to work it is necessary to make Emacs think
          ;; we're completing with respect to "ELEMENT@@/" rather
          ;; than "ELEMENT@@". Otherwise when we enter a version
          ;; like "/main/NN", it thinks we entered an absolute path.