[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/vc-fossil 1bef549 109/111: From Upstream: ams: Add (vc-fos
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/vc-fossil 1bef549 109/111: From Upstream: ams: Add (vc-fossil-link) |
Date: |
Wed, 29 Sep 2021 08:59:31 -0400 (EDT) |
branch: elpa/vc-fossil
commit 1bef549e51f961f75be2322dee84be37bb3dbf07
Author: venks1 <venksi@gmail.com>
Commit: GitHub <noreply@github.com>
From Upstream: ams: Add (vc-fossil-link)
---
vc-fossil.el | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/vc-fossil.el b/vc-fossil.el
index 67921a8..04c12eb 100644
--- a/vc-fossil.el
+++ b/vc-fossil.el
@@ -598,6 +598,41 @@ If nil, use the value of `vc-diff-switches'. If t, use no
switches."
(let ((default-directory (vc-fossil-root file-or-dir)))
(cadr (assoc (or remote-name "default") (vc-fossil--remotes)))))
+;; Useful functions for interacting with Fossil
+
+(defun vc-fossil--url-without-authinfo (url)
+ (let ((parsed (url-generic-parse-url url)))
+ (setf (url-user parsed) nil)
+ (setf (url-password parsed) nil)
+ (url-recreate-url parsed)))
+
+(defun vc-fossil--relative-file-name (file)
+ (let ((l0 (car (split-string (vc-fossil--run "finfo" file) "\n" t))))
+ (save-match-data
+ (and (string-match "^History for \\(.*\\)$" l0)
+ (setq file (match-string 1 l0)))
+ file)))
+
+(defun vc-fossil-link (start end)
+ "Puts the current URL to a file in the kill ring."
+ (interactive "r")
+ (let ((default-directory (file-name-directory (buffer-file-name
(current-buffer)))))
+ (unless (vc-fossil-registered (buffer-file-name))
+ (error "%s: file is not registerd in vc" (buffer-file-name)))
+ (let* ((repository-url (vc-fossil--url-without-authinfo
+ (vc-fossil-repository-url (buffer-file-name))))
+ (file (vc-fossil--relative-file-name (buffer-file-name)))
+ (tag (vc-fossil-working-revision (buffer-file-name
(current-buffer))))
+ (start (line-number-at-pos (region-beginning)))
+ (end (line-number-at-pos (region-end))))
+ (if (= start end)
+ (setq link (format "%s/file?ci=%s&name=%s&ln=%s"
+ repository-url tag file start))
+ (setq link (format "%s/file?ci=%s&name=%s&ln=%s-%s"
+ repository-url tag file start end)))
+ (kill-new link)
+ (message "%s" link))))
+
;;; This snippet enables the Fossil VC backend so it will work once
;;; this file is loaded. By also marking it for inclusion in the
;;; autoloads file, installing packaged versions of this should work
- [nongnu] elpa/vc-fossil 2747e6c 103/111: Move vc-fossil.el to top dir, (continued)
- [nongnu] elpa/vc-fossil 2747e6c 103/111: Move vc-fossil.el to top dir, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 4d3e1cb 086/111: Update vc-dir header info after fossil commands., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil ec551ba 056/111: Implement previous-revision command for whole repository., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil a57356e 061/111: Refactor find-revision command., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 866bd8d 059/111: Use relative file names in print-log command., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil be45ea1 066/111: Declare some unknown function and variables., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil ac82044 065/111: Do not raise errors in next-revision and previous-revision commands., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 007187d 075/111: Merge changes from pdo for emacs 25 support, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 67855dd 081/111: Fixed accidental breakage in last commit., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil e0d3521 085/111: Enforced double-dash internal function convention., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 1bef549 109/111: From Upstream: ams: Add (vc-fossil-link),
ELPA Syncer <=
- [nongnu] elpa/vc-fossil 6beb2f2 092/111: Merge old trunk I hope, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 4e95c73 094/111: Merged., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 2fd4bf0 095/111: Improved vc-dir performance on large repositories., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil aff450c 018/111: deal with some compiler warnings (assignments to line etc remain), ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 0921094 023/111: whitespace and fiddle with a instructions comment, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil eeb48f4 024/111: fiddle with some if constructs so I can read this, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 5e71178 029/111: ideomatic lisp, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil adb17bc 034/111: Use file-truename in vc-fossil-state otherwise status is not returned if called from outside a fossil tree, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 13a0a69 036/111: Untabify, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 1319569 041/111: Show unregistered files in dir stat., ELPA Syncer, 2021/09/29