Changeset 10474
- Timestamp:
- 01/04/11 03:42:05 (17 months ago)
- Location:
- trunk/RepositoryPlugin
- Files:
-
- 2 edited
-
data/System/RepositoryPlugin.txt (modified) (1 diff)
-
lib/Foswiki/Plugins/RepositoryPlugin.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/RepositoryPlugin/data/System/RepositoryPlugin.txt
r10473 r10474 26 26 | =%<nop>REPO{}%= | Provide a git report on the topic expanding the macro | 27 27 | =%<nop>REPO{module="Foswiki::Module"}%= | Provide a git report on the specified Foswiki module. | 28 | =%<nop>REPO{web="Someweb" topic="SomeTopic"}%= | Provide a git report on the specified Web.Topic | 28 | =%<nop>REPO{[web="Someweb"] topic="[Someweb.]SomeTopic"}%= | Provide a git report on the specified Web.Topic | 29 | =%<nop>REPO{["svninfo" [module=] [topic=]}%= | Provide a =git svn info= report on the repo containing the topic or module | 30 | =%<nop>REPO{["status" [module=] [topic=]}%= | Provide a =git status= report on the repo containing the topic or module | 29 31 30 32 ---++ Examples 31 33 32 ---+++ Report for this topic34 ---+++ Report git status for this topic file =%SYSTEMWEB%/%TOPIC%.txt= 33 35 If installed, the ==%<nop>REPO{}%== macro will expand to the status of this topic file - =%WEB%/%TOPIC%.txt=. 34 36 35 37 %REPO{}% 36 38 37 ---+++ =git svn info= reportfor this topic's repository39 ---+++ Report =git svn info= for this topic's repository 38 40 If installed, the ==%<nop>REPO{"svninfo"}%== report will expand to the svn information about the repository that contains this topic. 39 41 40 42 %REPO{"svninfo"}% 41 43 42 ---+++ Report for Main.WebHome43 The ==%<nop>REPO{web=" Main" topic="WebHome"}%== (or alternate form ==%<nop>REPO{topic="Main.WebHome"}%== ) expands to a report on the specified topic file.44 ---+++ Report git status for the topic file =%USERSWEB%.WebHome.txt= 45 The ==%<nop>REPO{web="%USERSWEB%" topic="WebHome"}%== (or alternate form ==%<nop>REPO{topic="Main.WebHome"}%== ) expands to a report on the specified topic file. 44 46 45 47 %REPO{topic="Main.WebHome"}% 46 48 47 ---+++ Report for =Foswiki::Plugins::RepositoryPlugin=49 ---+++ Report git status for =Foswiki::Plugins::RepositoryPlugin= 48 50 The ==%<nop>REPO{module="Foswiki::Plugins::RepositoryPlugin"}%== provides a report on the Plugin module implementing the %REPO macro. Note that an alternative to [[%SYSTEMWEB%.PerlDoc]] - [[%SYSTEMWEB%.RepoPerlDoc]] is provided with this plugin. 49 51 50 52 %REPO{module="Foswiki::Plugins::RepositoryPlugin"}% 53 54 ---+++ Report =git status= for the repository contatining =Foswiki::Plugins::RepositoryPlugin= 55 The ==%<nop>REPO{"status" module="Foswiki::Plugins::RepositoryPlugin"}%== provides a report on the Plugin module implementing the %REPO macro. Untracked files are not reported. 56 57 %REPO{"status" module="Foswiki::Plugins::RepositoryPlugin"}% 51 58 52 59 ---++ Installation Instructions -
trunk/RepositoryPlugin/lib/Foswiki/Plugins/RepositoryPlugin.pm
r10473 r10474 185 185 return $report; 186 186 } 187 188 ( my $topicStatus, $exit ) = Foswiki::Sandbox->sysCommand( 189 "$gitbin $repoLoc status --porcelain $absfile ", 190 ); 191 192 $topicStatus = substr( $topicStatus, 0, 2 ); 193 194 return "*File not known to git:* =$absfile= " if ( $topicStatus eq '??' ); 195 196 my $status = 197 $topicStatus =~ m/\ [MD]/ ? 'Modified, not updated in index' 198 : $topicStatus =~ m/M[\ MD]/ ? 'updated in index' 199 : $topicStatus =~ m/A[\ MD]/ ? 'added to index' 200 : $topicStatus =~ m/D[\ M]/ ? 'deleted from index' 201 : $topicStatus =~ m/R[\ MD]/ ? 'renamed in index' 202 : $topicStatus =~ m/C[\ MD]/ ? 'copied in index' 203 : $topicStatus eq '' ? 'up to date' 204 : 'unknown'; 205 206 ( my $topicinfo, $exit ) = 207 Foswiki::Sandbox->sysCommand( "$gitbin $repoLoc log -1 $absfile ", ); 208 209 my $report = "*Repo file:* =$absfile= \n\n*Repo root:* $repoRoot\n\n"; 210 211 $report .= "*File Status:* ($topicStatus) - $status\n\n"; 212 213 $report .= "*Last Commit:* \n" . '<verbatim>' . $topicinfo . '</verbatim>' 214 unless $exit; 215 216 return $report; 217 187 elsif ( $default eq 'status' ) { 188 #my ($curdir) = getcwd =~ m/^(.*)$/; 189 #chdir($repoRoot); 190 ( my $repoInfo, $exit ) = 191 Foswiki::Sandbox->sysCommand( "$gitbin $repoLoc status -uno", ); 192 #chdir($curdir); 193 my $report .= " " . '<verbatim>' . $repoInfo . '</verbatim>' 194 unless $exit; 195 196 return $report; 197 } 198 else { 199 200 ( my $fileStatus, $exit ) = Foswiki::Sandbox->sysCommand( 201 "$gitbin $repoLoc status --porcelain $absfile ", 202 ); 203 204 $fileStatus = substr( $fileStatus, 0, 2 ); 205 206 return "*File not known to git:* =$absfile= " if ( $fileStatus eq '??' ); 207 208 my $status = 209 $fileStatus =~ m/\ [MD]/ ? 'Modified, not updated in index' 210 : $fileStatus =~ m/M[\ MD]/ ? 'updated in index' 211 : $fileStatus =~ m/A[\ MD]/ ? 'added to index' 212 : $fileStatus =~ m/D[\ M]/ ? 'deleted from index' 213 : $fileStatus =~ m/R[\ MD]/ ? 'renamed in index' 214 : $fileStatus =~ m/C[\ MD]/ ? 'copied in index' 215 : $fileStatus eq '' ? 'up to date' 216 : 'unknown'; 217 218 ( my $topicinfo, $exit ) = 219 Foswiki::Sandbox->sysCommand( "$gitbin $repoLoc log -1 $absfile ", ); 220 221 my $report = "*Repo file:* =$absfile= \n\n*Repo root:* $repoRoot\n\n"; 222 223 $report .= "*File Status:* ($fileStatus) - $status\n\n"; 224 225 $report .= "*Last Commit:* \n" . '<verbatim>' . $topicinfo . '</verbatim>' 226 unless $exit; 227 228 return $report; 229 } 230 231 232 ### 233 ### DEAD CODE 234 ### 218 235 my ( $gitinfo, $gexit ) = 219 236 Foswiki::Sandbox->sysCommand( "$gitbin $repoLoc svn info ", ); … … 227 244 unless ( $sexit || $svninfo =~ m/not a working copy/ ); 228 245 229 # if ($repoInfo->{type} eq 'svn') {230 # $svninfo =~ /Path: (231 # Path: .232 # URL: http://svn.twiki.org/svn/twiki/trunk/core233 # Repository Root: http://svn.twiki.org/svn234 # Repository UUID: a00a5322-12db-0310-a70b-8735589c885e235 # Revision: 19150236 # Node Kind: directory237 # Schedule: normal238 # Last Changed Author: PeterThoeny239 # Last Changed Rev: 19140240 # Last Changed Date: 2010-06-27 02:42:03 -0400 (Sun, 27 Jun 2010)241 #242 # gac@cardinal: /data/gac/SVN/twiki/core $ cd -243 # /data/gac/SVN/twiki244 # gac@cardinal: /data/gac/SVN/twiki $ cd /var/www/foswiki/trunk/245 # gac@cardinal: /var/www/foswiki/trunk (Item9238-BuildContrib)$ git svn info246 # Path: .247 # URL: http://svn.foswiki.org/trunk248 # Repository Root: http://svn.foswiki.org249 # Repository UUID: 0b4bb1d4-4e5a-0410-9cc4-b2b747904278250 # Revision: 8030251 # Node Kind: directory252 # Schedule: normal253 # Last Changed Author: CrawfordCurrie254 # Last Changed Rev: 8030255 # Last Changed Date: 2010-07-05 05:21:49 -0400 (Mon, 05 Jul 2010)256 #257 246 258 247 my $cmd = $params->{_DEFAULT} || '';
Note: See TracChangeset
for help on using the changeset viewer.
