4141(require 'ibuf-ext )
4242(require 'compile )
4343(require 'grep )
44+ (require 'lisp-mnt )
45+ (require 'xml )
4446(eval-when-compile
4547 (require 'find-dired )
4648 (require 'subr-x ))
@@ -350,6 +352,7 @@ See `projectile-register-project-type'."
350352 " .pijul" ; Pijul VCS root dir
351353 " .sl" ; Sapling VCS root dir
352354 " .jj" ; Jujutsu VCS root dir
355+ " .osc" ; Osc VCS root dir
353356 )
354357 " A list of files considered to mark the root of a project.
355358The bottommost (parentmost) match has precedence."
@@ -445,7 +448,8 @@ is set to `alien'."
445448 " .cache"
446449 " .clangd"
447450 " .sl"
448- ".jj")
451+ " .jj"
452+ " *\\ .osc$" )
449453 " A list of directories globally ignored by projectile.
450454
451455Strings that don't start with * are only ignored at the top level
@@ -800,6 +804,10 @@ Set to nil to disable listing submodules contents."
800804 " Command used by projectile to get the files in a svn project."
801805 :group 'projectile
802806 :type 'string )
807+ (defcustom projectile-osc-command #'projectile-osc-command-files
808+ " Command used by projectile to get the files in a svn project."
809+ :group 'projectile
810+ :type '(function string))
803811
804812(defcustom projectile-generic-command
805813 (cond
@@ -1548,8 +1556,22 @@ Fallback to a generic command when not in a VCS-controlled project."
15481556 ('svn projectile-svn-command)
15491557 ('sapling projectile-sapling-command)
15501558 ('jj projectile-jj-command)
1559+ ('osc projectile-osc-command)
15511560 (_ projectile-generic-command)))
15521561
1562+
1563+ (defun projectile-osc-command-files (&optional root )
1564+ " Return files of osc vcs, return either packages or files belonging to package."
1565+ (or root (setq root default-directory))
1566+ (let* ((files_ (car (xml-parse-file (if (file-exists-p " .osc/_files" )
1567+ (expand-file-name " .osc/_files" )
1568+ (if (file-exists-p " .osc/_packages" )
1569+ (expand-file-name " .osc/_packages" )
1570+ (error " Directory neither osc package or project " ))))))
1571+ (entries (or (xml-get-children files_ 'entry )
1572+ (xml-get-children files_ 'package ))))
1573+ (mapcar (lambda (entry ) (xml-get-attribute entry 'name )) entries)))
1574+
15531575(defun projectile-get-sub-projects-command (vcs )
15541576 " Get the sub-projects command for VCS.
15551577Currently that's supported just for Git (sub-projects being Git
@@ -1646,12 +1668,15 @@ If `command' is nil or an empty string, return nil.
16461668This allows commands to be disabled.
16471669
16481670Only text sent to standard output is taken into account."
1649- (when (stringp command)
1671+ (when (or (stringp command)
1672+ (functionp command))
16501673 (let ((default-directory root))
1674+ (if (functionp command)
1675+ (funcall command root)
16511676 (with-temp-buffer
16521677 (shell-command command t " *projectile-files-errors*" )
16531678 (let ((shell-output (buffer-substring (point-min ) (point-max ))))
1654- (split-string (string-trim shell-output) "\0" t))))))
1679+ (split-string (string-trim shell-output) " \0 " t )))))))
16551680
16561681(defun projectile-adjust-files (project vcs files )
16571682 " First remove ignored files from FILES, then add back unignored files."
@@ -3797,6 +3822,7 @@ the variable `projectile-project-root'."
37973822 ((projectile-file-exists-p (expand-file-name " .svn" project-root)) 'svn )
37983823 ((projectile-file-exists-p (expand-file-name " .sl" project-root)) 'sapling )
37993824 ((projectile-file-exists-p (expand-file-name " .jj" project-root)) 'jj )
3825+ ((projectile-file-exists-p (expand-file-name " .osc" project-root)) 'osc )
38003826 ; ; then we check if there's a VCS marker up the directory tree
38013827 ; ; that covers the case when a project is part of a multi-project repository
38023828 ; ; in those cases you can still the VCS to get a list of files for
@@ -3811,6 +3837,7 @@ the variable `projectile-project-root'."
38113837 ((projectile-locate-dominating-file project-root " .svn" ) 'svn )
38123838 ((projectile-locate-dominating-file project-root " .sl" ) 'sapling )
38133839 ((projectile-locate-dominating-file project-root " .jj" ) 'jj )
3840+ ((projectile-locate-dominating-file project-root " .osc" ) 'osc )
38143841 (t 'none )))
38153842
38163843(defun projectile--test-name-for-impl-name (impl-file-path )
0 commit comments