43
43
(require 'compile )
44
44
(require 'grep )
45
45
(require 'lisp-mnt )
46
+ (require 'xml )
46
47
(eval-when-compile
47
48
(require 'find-dired )
48
49
(require 'subr-x ))
@@ -331,6 +332,7 @@ See `projectile-register-project-type'."
331
332
" .pijul" ; Pijul VCS root dir
332
333
" .sl" ; Sapling VCS root dir
333
334
" .jj" ; Jujutsu VCS root dir
335
+ " .osc" ; Osc VCS root dir
334
336
)
335
337
" A list of files considered to mark the root of a project.
336
338
The bottommost (parentmost) match has precedence."
@@ -426,7 +428,9 @@ is set to `alien'."
426
428
" ^\\ .cache$"
427
429
" ^\\ .clangd$"
428
430
" ^\\ .sl$"
429
- " ^\\ .jj$" )
431
+ " ^\\ .jj$"
432
+ " *\\ .osc$"
433
+ " ^\\ .clangd$" )
430
434
" A list of directories globally ignored by projectile.
431
435
Regular expressions can be used.
432
436
@@ -765,6 +769,10 @@ Set to nil to disable listing submodules contents."
765
769
" Command used by projectile to get the files in a svn project."
766
770
:group 'projectile
767
771
: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))
768
776
769
777
(defcustom projectile-generic-command
770
778
(cond
@@ -1484,8 +1492,22 @@ Fallback to a generic command when not in a VCS-controlled project."
1484
1492
('svn projectile-svn-command)
1485
1493
('sapling projectile-sapling-command)
1486
1494
('jj projectile-jj-command)
1495
+ ('osc projectile-osc-command)
1487
1496
(_ projectile-generic-command)))
1488
1497
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
+
1489
1511
(defun projectile-get-sub-projects-command (vcs )
1490
1512
" Get the sub-projects command for VCS.
1491
1513
Currently that's supported just for Git (sub-projects being Git
@@ -1582,12 +1604,15 @@ If `command' is nil or an empty string, return nil.
1582
1604
This allows commands to be disabled.
1583
1605
1584
1606
Only text sent to standard output is taken into account."
1585
- (when (stringp command)
1607
+ (when (or (stringp command)
1608
+ (functionp command))
1586
1609
(let ((default-directory root))
1610
+ (if (functionp command)
1611
+ (funcall command root)
1587
1612
(with-temp-buffer
1588
1613
(shell-command command t " *projectile-files-errors*" )
1589
1614
(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 )))))))
1591
1616
1592
1617
(defun projectile-adjust-files (project vcs files )
1593
1618
" First remove ignored files from FILES, then add back unignored files."
@@ -3700,6 +3725,7 @@ the variable `projectile-project-root'."
3700
3725
((projectile-file-exists-p (expand-file-name " .svn" project-root)) 'svn )
3701
3726
((projectile-file-exists-p (expand-file-name " .sl" project-root)) 'sapling )
3702
3727
((projectile-file-exists-p (expand-file-name " .jj" project-root)) 'jj )
3728
+ ((projectile-file-exists-p (expand-file-name " .osc" project-root)) 'osc )
3703
3729
; ; then we check if there's a VCS marker up the directory tree
3704
3730
; ; that covers the case when a project is part of a multi-project repository
3705
3731
; ; in those cases you can still the VCS to get a list of files for
@@ -3714,6 +3740,7 @@ the variable `projectile-project-root'."
3714
3740
((projectile-locate-dominating-file project-root " .svn" ) 'svn )
3715
3741
((projectile-locate-dominating-file project-root " .sl" ) 'sapling )
3716
3742
((projectile-locate-dominating-file project-root " .jj" ) 'jj )
3743
+ ((projectile-locate-dominating-file project-root " .osc" ) 'osc )
3717
3744
(t 'none )))
3718
3745
3719
3746
(defun projectile--test-name-for-impl-name (impl-file-path )
0 commit comments