Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | new `clone' interceptor. |
---|---|
Timelines: | family | ancestors | descendants | both | dresden |
Files: | files | file ages | folders |
SHA1: |
6a18f733ad5cabcf2df4246aa1e2daba |
User & Date: | j 2018-10-25 21:19:01 |
Context
2019-05-21
| ||
17:48 | minor adjustments. check-in: 5a7ab09561 user: j tags: dresden | |
2018-10-25
| ||
21:19 | new `clone' interceptor. check-in: 6a18f733ad user: j tags: dresden | |
2018-10-19
| ||
08:30 | fix typo in help text/comment. check-in: 5bd4c8a1a9 user: j tags: dresden | |
Changes
Changes to fsl.
︙ | ︙ | |||
790 791 792 793 794 795 796 797 798 799 800 801 802 803 | puts "" } } interceptor st:status { return [lreplace $params 0 0 status] } interceptor s:show { # ------------------------------------------------------------------------ # Provide repository status information the hg/svn way. # ------------------------------------------------------------------------ set afilter ::config::fslrc::status | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | puts "" } } interceptor st:status { return [lreplace $params 0 0 status] } interceptor clon:clone { # ------------------------------------------------------------------------ # Catch the case where `clone' is issued without the mandatory # trailing FILENAME argument. If this happens a default name for the # repo and checkout directory is constructed, a checkout directory is # created (if not yet existing), and the repo is cloned and opened in # this checkout directory. the name generation strategy is roughly as # follows (for details, see the source code): # # * determine basename of URI # * strip leading `.' and trailing `.'-separated extender from the basename # * trim leading and trailing blanks, if any # * replace remaining blanks by underscore # * append "-fsl" # * use resulting name as checkout directory and create it # * clone repo into this directory under the invariant name `.fslrepo' # # Otherwise (if FILENAME is provided) just pass the call unmodified to # fossil. # ------------------------------------------------------------------------ set defaultName .fslrepo set params [lreplace $params 0 0 clone] set hasOpts [regexp {^-} [lindex $params 1]] if {!$hasOpts && [llength $params] == 3} { # we do not want to parse all possible `clone' options properly, # but this case (a call without options but two arguments...) # clearly should be passed through to `fossil' unchanged. return $params } elseif {[catch {exec fossil {*}$params} msg]} { # there might be other reasons for failure (e.g. a typo in # URI specification in a call using options (that thus # reaches this block) ...), but we confidentally assume that # an error signals omission of the FILENAME argument expected # by `clone' and thus the intention to automaticlly # "clone+open" the repo using the described naming strategy. set uri [lindex $params end] set remoteName [lindex [file split $uri] end] set checkout [split [string trimleft $remoteName .] .] if {[llength $checkout] > 1} { set checkout [lreplace $checkout end end] } set checkout [string trim [join $checkout]] regsub {(.*)-fsl$} $checkout {\1} checkout regsub -all { } $checkout {_} checkout append checkout -fsl if {[file exists $checkout]} { puts "$checkout: file exists" exit 1 } if {[catch {file mkdir $checkout} msg]} { puts $msg exit 1 } else { cd $checkout lappend params $defaultName puts "cloning to ./$checkout ..." if {[catch {exec fossil {*}$params} msg]} { puts $msg exit 1 } else { if {[catch {exec fossil open $defaultName} msg]} { puts $msg exit 1 } } } } else { return $params } } interceptor s:show { # ------------------------------------------------------------------------ # Provide repository status information the hg/svn way. # ------------------------------------------------------------------------ set afilter ::config::fslrc::status |
︙ | ︙ |