4343(require 'compile )
4444(require 'grep )
4545(require 'lisp-mnt )
46+ (require 'xml )
4647(eval-when-compile
4748 (require 'find-dired )
4849 (require 'subr-x ))
@@ -333,6 +334,7 @@ See `projectile-register-project-type'."
333334 " .pijul" ; Pijul VCS root dir
334335 " .sl" ; Sapling VCS root dir
335336 " .jj" ; Jujutsu VCS root dir
337+ " .osc" ; Osc VCS root dir
336338 )
337339 " A list of files considered to mark the root of a project.
338340The bottommost (parentmost) match has precedence."
@@ -428,7 +430,9 @@ is set to `alien'."
428430 " ^\\ .cache$"
429431 " ^\\ .clangd$"
430432 " ^\\ .sl$"
431- " ^\\ .jj$" )
433+ " ^\\ .jj$"
434+ " *\\ .osc$"
435+ " ^\\ .clangd$" )
432436 " A list of directories globally ignored by projectile.
433437Regular expressions can be used.
434438
@@ -767,6 +771,10 @@ Set to nil to disable listing submodules contents."
767771 " Command used by projectile to get the files in a svn project."
768772 :group 'projectile
769773 :type 'string )
774+ (defcustom projectile-osc-command #'projectile-osc-command-files
775+ " Command used by projectile to get the files in a svn project."
776+ :group 'projectile
777+ :type '(function string))
770778
771779(defcustom projectile-generic-command
772780 (cond
@@ -1489,8 +1497,22 @@ Fallback to a generic command when not in a VCS-controlled project."
14891497 ('svn projectile-svn-command)
14901498 ('sapling projectile-sapling-command)
14911499 ('jj projectile-jj-command)
1500+ ('osc projectile-osc-command)
14921501 (_ projectile-generic-command)))
14931502
1503+
1504+ (defun projectile-osc-command-files (&optional root )
1505+ " Return files of osc vcs, return either packages or files belonging to package."
1506+ (or root (setq root default-directory))
1507+ (let* ((files_ (car (xml-parse-file (if (file-exists-p " .osc/_files" )
1508+ (expand-file-name " .osc/_files" )
1509+ (if (file-exists-p " .osc/_packages" )
1510+ (expand-file-name " .osc/_packages" )
1511+ (error " Directory neither osc package or project " ))))))
1512+ (entries (or (xml-get-children files_ 'entry )
1513+ (xml-get-children files_ 'package ))))
1514+ (mapcar (lambda (entry ) (xml-get-attribute entry 'name )) entries)))
1515+
14941516(defun projectile-get-sub-projects-command (vcs )
14951517 " Get the sub-projects command for VCS.
14961518Currently that's supported just for Git (sub-projects being Git
@@ -1587,12 +1609,15 @@ If `command' is nil or an empty string, return nil.
15871609This allows commands to be disabled.
15881610
15891611Only text sent to standard output is taken into account."
1590- (when (stringp command)
1612+ (when (or (stringp command)
1613+ (functionp command))
15911614 (let ((default-directory root))
1615+ (if (functionp command)
1616+ (funcall command root)
15921617 (with-temp-buffer
15931618 (shell-command command t " *projectile-files-errors*" )
15941619 (let ((shell-output (buffer-substring (point-min ) (point-max ))))
1595- (split-string (string-trim shell-output) " \0 " t ))))))
1620+ (split-string (string-trim shell-output) " \0 " t )))))))
15961621
15971622(defun projectile-adjust-files (project vcs files )
15981623 " First remove ignored files from FILES, then add back unignored files."
@@ -3680,6 +3705,7 @@ the variable `projectile-project-root'."
36803705 ((projectile-file-exists-p (expand-file-name " .svn" project-root)) 'svn )
36813706 ((projectile-file-exists-p (expand-file-name " .sl" project-root)) 'sapling )
36823707 ((projectile-file-exists-p (expand-file-name " .jj" project-root)) 'jj )
3708+ ((projectile-file-exists-p (expand-file-name " .osc" project-root)) 'osc )
36833709 ; ; then we check if there's a VCS marker up the directory tree
36843710 ; ; that covers the case when a project is part of a multi-project repository
36853711 ; ; in those cases you can still the VCS to get a list of files for
@@ -3694,6 +3720,7 @@ the variable `projectile-project-root'."
36943720 ((projectile-locate-dominating-file project-root " .svn" ) 'svn )
36953721 ((projectile-locate-dominating-file project-root " .sl" ) 'sapling )
36963722 ((projectile-locate-dominating-file project-root " .jj" ) 'jj )
3723+ ((projectile-locate-dominating-file project-root " .osc" ) 'osc )
36973724 (t 'none )))
36983725
36993726(defun projectile--test-name-for-impl-name (impl-file-path )
0 commit comments