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 ))
@@ -331,6 +332,7 @@ See `projectile-register-project-type'."
331332 " .pijul" ; Pijul VCS root dir
332333 " .sl" ; Sapling VCS root dir
333334 " .jj" ; Jujutsu VCS root dir
335+ " .osc" ; Osc VCS root dir
334336 )
335337 " A list of files considered to mark the root of a project.
336338The bottommost (parentmost) match has precedence."
@@ -426,7 +428,9 @@ is set to `alien'."
426428 " ^\\ .cache$"
427429 " ^\\ .clangd$"
428430 " ^\\ .sl$"
429- " ^\\ .jj$" )
431+ " ^\\ .jj$"
432+ " *\\ .osc$"
433+ " ^\\ .clangd$" )
430434 " A list of directories globally ignored by projectile.
431435Regular expressions can be used.
432436
@@ -765,6 +769,10 @@ Set to nil to disable listing submodules contents."
765769 " Command used by projectile to get the files in a svn project."
766770 :group 'projectile
767771 :type 'string )
772+ (defcustom projectile-osc-command #'projectile-osc-command-files
773+ " Command used by projectile to get the files in a svn project."
774+ :group 'projectile
775+ :type '(function string))
768776
769777(defcustom projectile-generic-command
770778 (cond
@@ -1484,8 +1492,22 @@ Fallback to a generic command when not in a VCS-controlled project."
14841492 ('svn projectile-svn-command)
14851493 ('sapling projectile-sapling-command)
14861494 ('jj projectile-jj-command)
1495+ ('osc projectile-osc-command)
14871496 (_ projectile-generic-command)))
14881497
1498+
1499+ (defun projectile-osc-command-files (&optional root )
1500+ " Return files of osc vcs, return either packages or files belonging to package."
1501+ (or root (setq root default-directory))
1502+ (let* ((files_ (car (xml-parse-file (if (file-exists-p " .osc/_files" )
1503+ (expand-file-name " .osc/_files" )
1504+ (if (file-exists-p " .osc/_packages" )
1505+ (expand-file-name " .osc/_packages" )
1506+ (error " Directory neither osc package or project " ))))))
1507+ (entries (or (xml-get-children files_ 'entry )
1508+ (xml-get-children files_ 'package ))))
1509+ (mapcar (lambda (entry ) (xml-get-attribute entry 'name )) entries)))
1510+
14891511(defun projectile-get-sub-projects-command (vcs )
14901512 " Get the sub-projects command for VCS.
14911513Currently that's supported just for Git (sub-projects being Git
@@ -1582,12 +1604,15 @@ If `command' is nil or an empty string, return nil.
15821604This allows commands to be disabled.
15831605
15841606Only text sent to standard output is taken into account."
1585- (when (stringp command)
1607+ (when (or (stringp command)
1608+ (functionp command))
15861609 (let ((default-directory root))
1610+ (if (functionp command)
1611+ (funcall command root)
15871612 (with-temp-buffer
15881613 (shell-command command t " *projectile-files-errors*" )
15891614 (let ((shell-output (buffer-substring (point-min ) (point-max ))))
1590- (split-string (string-trim shell-output) " \0 " t ))))))
1615+ (split-string (string-trim shell-output) " \0 " t )))))))
15911616
15921617(defun projectile-adjust-files (project vcs files )
15931618 " First remove ignored files from FILES, then add back unignored files."
@@ -3700,6 +3725,7 @@ the variable `projectile-project-root'."
37003725 ((projectile-file-exists-p (expand-file-name " .svn" project-root)) 'svn )
37013726 ((projectile-file-exists-p (expand-file-name " .sl" project-root)) 'sapling )
37023727 ((projectile-file-exists-p (expand-file-name " .jj" project-root)) 'jj )
3728+ ((projectile-file-exists-p (expand-file-name " .osc" project-root)) 'osc )
37033729 ; ; then we check if there's a VCS marker up the directory tree
37043730 ; ; that covers the case when a project is part of a multi-project repository
37053731 ; ; in those cases you can still the VCS to get a list of files for
@@ -3714,6 +3740,7 @@ the variable `projectile-project-root'."
37143740 ((projectile-locate-dominating-file project-root " .svn" ) 'svn )
37153741 ((projectile-locate-dominating-file project-root " .sl" ) 'sapling )
37163742 ((projectile-locate-dominating-file project-root " .jj" ) 'jj )
3743+ ((projectile-locate-dominating-file project-root " .osc" ) 'osc )
37173744 (t 'none )))
37183745
37193746(defun projectile--test-name-for-impl-name (impl-file-path )
0 commit comments