Difference between pages "My companion" and "Svn at head"

From Kolmafia
(Difference between pages)
Jump to navigation Jump to search
imported>Bale
(r11965)
 
imported>Bale
(r12198)
 
Line 1: Line 1:
 
{{
 
{{
#vardefine:name|my_companion}}{{
+
#vardefine:name|svn_at_head}}{{
#vardefine:return_type|string}}{{
+
#vardefine:return_type|boolean}}{{
  
 
FunctionPage|
 
FunctionPage|
Line 10: Line 10:
 
aggregate={{#var:aggregate}}|
 
aggregate={{#var:aggregate}}|
 
return_type={{#var:return_type}}|
 
return_type={{#var:return_type}}|
return_also={{#var:return_also}}
+
return_also={{#var:return_also}}|
 +
parameter1={{Param|string|projectname}}|
 +
p1desc={{Pspan|projectname}} is the name of a project which may exist on an SVN repo|
 
}}|
 
}}|
  
function_description=If your current path is Avatar of Jarlsberg this returns your current companion. If you have no current companion or you are not Jarlsberg's Avatar, then this returns an empty string.|
+
function_description=Returns true if {{Pspan|projectname}} exists, is a valid working copy, and is currently at the same revision number as the repository. {{Pspan|projectname}} will match any unique substring of any project in the /svn folder, but it is case sensitive.|
  
 
code1={{CodeSample|
 
code1={{CodeSample|
title=Code Samples|
+
title=Code Sample|
description=Determines Item Drop bonus granted by from Companion.|
+
description=Checks for a project|
 
code=
 
code=
 
<syntaxhighlight>
 
<syntaxhighlight>
if( my_path() == "Avatar of Jarlsberg" ) {
+
if( !svn_at_head( "mafiachit" ) ) {
   if( my_companion() != "Eggman" )
+
   print( "ChIT is not up to date! If you want to update it, copy/paste the following line into your CLI and hit enter." );
      print( "You need to equip the Eggman for item drops." );
+
   print( "svn update mafiachit", "blue" );
   else {
 
      int drop = 50;
 
      if( have_skill($skill[Working Lunch]) )
 
        drop += 25;
 
      print( "The item drop bonus from the Eggman is " + drop );
 
  }
 
 
}
 
}
</syntaxhighlight>
+
</syntaxhighlight>}}|
}}|
+
cli_equiv=The CLI command "svn list" will provide related information.|
 
+
see_also={{SeeAlso|svn_exists|svn_info}}|
 
}}
 
}}
  
[[Category:Your Character]]
+
[[Category:Miscellaneous Functions]]

Latest revision as of 00:44, 12 November 2014

Function Syntax

boolean svn_at_head(string projectname )

  • projectname is the name of a project which may exist on an SVN repo

Returns true if projectname exists, is a valid working copy, and is currently at the same revision number as the repository. projectname will match any unique substring of any project in the /svn folder, but it is case sensitive.

Code Sample

Checks for a project

if( !svn_at_head( "mafiachit" ) ) {
   print( "ChIT is not up to date! If you want to update it, copy/paste the following line into your CLI and hit enter." );
   print( "svn update mafiachit", "blue" );
}

CLI Equivalent

The CLI command "svn list" will provide related information.

See Also

svn_exists() | svn_info()