-
-
Notifications
You must be signed in to change notification settings - Fork 587
Support OSC-SCM #1890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Support OSC-SCM #1890
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,8 @@ | |
(require 'ibuf-ext) | ||
(require 'compile) | ||
(require 'grep) | ||
(require 'xml) | ||
|
||
(eval-when-compile | ||
(require 'find-dired) | ||
(require 'subr-x)) | ||
|
@@ -346,6 +348,7 @@ See `projectile-register-project-type'." | |
".pijul" ; Pijul VCS root dir | ||
".sl" ; Sapling VCS root dir | ||
".jj" ; Jujutsu VCS root dir | ||
".osc" ; Osc VCS root dir | ||
) | ||
"A list of files considered to mark the root of a project. | ||
The bottommost (parentmost) match has precedence." | ||
|
@@ -441,6 +444,7 @@ is set to `alien'." | |
".cache" | ||
".clangd" | ||
".sl" | ||
".osc" | ||
".jj") | ||
"A list of directories globally ignored by projectile. | ||
|
||
|
@@ -796,6 +800,10 @@ Set to nil to disable listing submodules contents." | |
"Command used by projectile to get the files in a svn project." | ||
:group 'projectile | ||
:type 'string) | ||
(defcustom projectile-osc-command #'projectile-osc-command-files | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a blank line before this. |
||
"Command used by projectile to get the files in a svn project." | ||
:group 'projectile | ||
:type '(function string)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't forget to add a :package-version property. |
||
|
||
(defcustom projectile-generic-command | ||
(cond | ||
|
@@ -1538,8 +1546,22 @@ Fallback to a generic command when not in a VCS-controlled project." | |
('svn projectile-svn-command) | ||
('sapling projectile-sapling-command) | ||
('jj projectile-jj-command) | ||
('osc projectile-osc-command) | ||
(_ projectile-generic-command))) | ||
|
||
|
||
(defun projectile-osc-command-files (&optional root) | ||
"Return files of osc vcs, return either packages or files belonging to package." | ||
(or root (setq root default-directory)) | ||
(let* ((files_ (car (xml-parse-file (if (file-exists-p ".osc/_files") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to me a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because the file containing the content is called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will check using cond for this. |
||
(expand-file-name ".osc/_files") | ||
(if (file-exists-p ".osc/_packages") | ||
(expand-file-name ".osc/_packages") | ||
(error "Directory neither osc package or project")))))) | ||
(entries (or (xml-get-children files_ 'entry) | ||
(xml-get-children files_ 'package)))) | ||
(mapcar (lambda (entry) (xml-get-attribute entry 'name)) entries))) | ||
|
||
(defun projectile-get-sub-projects-command (vcs) | ||
"Get the sub-projects command for VCS. | ||
Currently that's supported just for Git (sub-projects being Git | ||
|
@@ -1636,12 +1658,15 @@ If `command' is nil or an empty string, return nil. | |
This allows commands to be disabled. | ||
|
||
Only text sent to standard output is taken into account." | ||
(when (stringp command) | ||
(when (or (stringp command) | ||
(functionp command)) | ||
(let ((default-directory root)) | ||
(if (functionp command) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm puzzled by this code, as you call the command, but don't do anything with the result. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do something with the result. The external command if a function is called, returns the list of files and that variable is returned. |
||
(funcall command root) | ||
(with-temp-buffer | ||
(shell-command command t "*projectile-files-errors*") | ||
(let ((shell-output (buffer-substring (point-min) (point-max)))) | ||
(split-string (string-trim shell-output) "\0" t)))))) | ||
(split-string (string-trim shell-output) "\0" t))))))) | ||
|
||
(defun projectile-adjust-files (project vcs files) | ||
"First remove ignored files from FILES, then add back unignored files." | ||
|
@@ -3787,6 +3812,7 @@ the variable `projectile-project-root'." | |
((projectile-file-exists-p (expand-file-name ".svn" project-root)) 'svn) | ||
((projectile-file-exists-p (expand-file-name ".sl" project-root)) 'sapling) | ||
((projectile-file-exists-p (expand-file-name ".jj" project-root)) 'jj) | ||
((projectile-file-exists-p (expand-file-name ".osc" project-root)) 'osc) | ||
;; then we check if there's a VCS marker up the directory tree | ||
;; that covers the case when a project is part of a multi-project repository | ||
;; in those cases you can still the VCS to get a list of files for | ||
|
@@ -3801,6 +3827,7 @@ the variable `projectile-project-root'." | |
((projectile-locate-dominating-file project-root ".svn") 'svn) | ||
((projectile-locate-dominating-file project-root ".sl") 'sapling) | ||
((projectile-locate-dominating-file project-root ".jj") 'jj) | ||
((projectile-locate-dominating-file project-root ".osc") 'osc) | ||
(t 'none))) | ||
|
||
(defun projectile--test-name-for-impl-name (impl-file-path) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest moving this in the function that uses it, so we don't slow down loading Projectile needlessly.