CVS update by scop packages/unsupported/scop/vc, vc-git.el ...

xemacs-cvs at xemacs.org xemacs-cvs at xemacs.org
Mon Jul 16 14:33:59 EDT 2007


  User: scop    
  Date: 07/07/16 20:33:59

  Modified:    packages/unsupported/scop/vc ChangeLog mercurial.el
                        vc-git.el
Log:
Sync mercurial.el and vc-git.el with upstreams.

Revision  Changes    Path
1.90      +1 -1      XEmacs/packages/unsupported/scop/STATUS

Index: STATUS
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/STATUS,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -p -r1.89 -r1.90
--- STATUS	2007/07/08 16:18:23	1.89
+++ STATUS	2007/07/16 18:33:48	1.90
@@ -18,6 +18,6 @@ generic-modes: generic.el and generic-x.
 
 vc: vc*.el and a few other related files from GNU Emacs, vc-git.el from git
 - Up to date with GNU Emacs 22.1 + some cherry picked bits from CVS HEAD,
-  hg, git upstream as of 2007-07-07.
+  hg, git upstream as of 2007-07-16.
 - Almost ready for general consumption, TODO list:
   - Check/make necessary changes to pcl-cvs, prog-modes, tramp and vc-cc.



1.85      +5 -0      XEmacs/packages/unsupported/scop/vc/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/vc/ChangeLog,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -p -r1.84 -r1.85
--- ChangeLog	2007/07/08 16:16:34	1.84
+++ ChangeLog	2007/07/16 18:33:54	1.85
@@ -1,3 +1,8 @@
+2007-07-16  Ville Skyttä  <scop at xemacs.org>
+
+	* mercurial.el: Sync with upstream.
+	* vc-git.el: Ditto.
+
 2007-07-08  Ville Skyttä  <scop at xemacs.org>
 
 	* Makefile (VERSION): 0.93.



1.3       +16 -3     XEmacs/packages/unsupported/scop/vc/mercurial.el

Index: mercurial.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/vc/mercurial.el,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- mercurial.el	2007/06/24 21:04:20	1.2
+++ mercurial.el	2007/07/16 18:33:54	1.3
@@ -1261,9 +1261,22 @@ Names are displayed relative to the repo
   (interactive)
   (error "not implemented"))
 
-(defun hg-version-other-window ()
-  (interactive)
-  (error "not implemented"))
+(defun hg-version-other-window (rev)
+  "Visit version REV of the current file in another window.
+If the current file is named `F', the version is named `F.~REV~'.
+If `F.~REV~' already exists, use it instead of checking it out again."
+  (interactive "sVersion to visit (default is workfile version): ")
+  (let* ((file buffer-file-name)
+       	 (version (if (string-equal rev "")
+		       "tip"
+		        rev))
+ 	 (automatic-backup (vc-version-backup-file-name file version))
+          (manual-backup (vc-version-backup-file-name file version 'manual)))
+     (unless (file-exists-p manual-backup)
+       (if (file-exists-p automatic-backup)
+           (rename-file automatic-backup manual-backup nil)
+         (hg-run0 "-q" "cat" "-r" version "-o" manual-backup file)))
+     (find-file-other-window manual-backup)))
 
 
 (provide 'mercurial)



1.9       +65 -0     XEmacs/packages/unsupported/scop/vc/vc-git.el

Index: vc-git.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/vc/vc-git.el,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -p -r1.8 -r1.9
--- vc-git.el	2007/02/03 13:08:38	1.8
+++ vc-git.el	2007/07/16 18:33:54	1.9
@@ -93,6 +93,71 @@
         (match-string 2 str)
       str)))
 
+(defun vc-git-symbolic-commit (commit)
+  "Translate COMMIT string into symbolic form.
+Returns nil if not possible."
+  (and commit
+       (with-temp-buffer
+	 (and
+	  (zerop
+	   (call-process "git" nil '(t nil) nil "name-rev"
+			 "--name-only" "--tags"
+			 commit))
+	  (goto-char (point-min))
+	  (= (forward-line 2) 1)
+	  (bolp)
+	  (buffer-substring-no-properties (point-min) (1- (point-max)))))))
+
+(defun vc-git-previous-version (file rev)
+  "git-specific version of `vc-previous-version'."
+  (let ((default-directory (file-name-directory (expand-file-name file)))
+	(file (file-name-nondirectory file)))
+    (vc-git-symbolic-commit
+     (with-temp-buffer
+       (and
+	(zerop
+	 (call-process "git" nil '(t nil) nil "rev-list"
+		       "-2" rev "--" file))
+	(goto-char (point-max))
+	(bolp)
+	(zerop (forward-line -1))
+	(not (bobp))
+	(buffer-substring-no-properties
+	   (point)
+	   (1- (point-max))))))))
+
+(defun vc-git-next-version (file rev)
+  "git-specific version of `vc-next-version'."
+  (let* ((default-directory (file-name-directory
+			     (expand-file-name file)))
+	(file (file-name-nondirectory file))
+	(current-rev
+	 (with-temp-buffer
+	   (and
+	    (zerop
+	     (call-process "git" nil '(t nil) nil "rev-list"
+			   "-1" rev "--" file))
+	    (goto-char (point-max))
+	    (bolp)
+	    (zerop (forward-line -1))
+	    (bobp)
+	    (buffer-substring-no-properties
+	     (point)
+	     (1- (point-max)))))))
+    (and current-rev
+	 (vc-git-symbolic-commit
+	  (with-temp-buffer
+	    (and
+	     (zerop
+	      (call-process "git" nil '(t nil) nil "rev-list"
+			    "HEAD" "--" file))
+	     (goto-char (point-min))
+	     (search-forward current-rev nil t)
+	     (zerop (forward-line -1))
+	     (buffer-substring-no-properties
+	      (point)
+	      (progn (forward-line 1) (1- (point))))))))))
+
 (defun vc-git-revert (file &optional contents-done)
   "Revert FILE to the version stored in the git repository."
   (if contents-done





More information about the XEmacs-CVS mailing list