Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
RevOptions Class Reference

Public Member Functions

None __init__ (self, Type["VersionControl"] vc_class, Optional[str] rev=None, Optional[CommandArgs] extra_args=None)
 
str __repr__ (self)
 
Optional[str] arg_rev (self)
 
CommandArgs to_args (self)
 
str to_display (self)
 
"RevOptions" make_new (self, str rev)
 

Data Fields

 extra_args
 
 rev
 
 vc_class
 

Detailed Description

Encapsulates a VCS-specific revision to install, along with any VCS
install options.

Instances of this class should be treated as if immutable.

Definition at line 124 of file versioncontrol.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ (   self,
Type["VersionControl"]  vc_class,
Optional[str]   rev = None,
Optional[CommandArgs]   extra_args = None 
)
Args:
  vc_class: a VersionControl subclass.
  rev: the name of the revision to install.
  extra_args: a list of extra options.

Definition at line 133 of file versioncontrol.py.

138 ) -> None:
139 """
140 Args:
141 vc_class: a VersionControl subclass.
142 rev: the name of the revision to install.
143 extra_args: a list of extra options.
144 """
145 if extra_args is None:
146 extra_args = []
147
148 self.extra_args = extra_args
149 self.rev = rev
150 self.vc_class = vc_class
151 self.branch_name: Optional[str] = None
152

Referenced by Protocol.__init_subclass__().

Here is the caller graph for this function:

Member Function Documentation

◆ __repr__()

str __repr__ (   self)

Definition at line 153 of file versioncontrol.py.

153 def __repr__(self) -> str:
154 return f"<RevOptions {self.vc_class.name}: rev={self.rev!r}>"
155

◆ arg_rev()

Optional[str] arg_rev (   self)

Definition at line 157 of file versioncontrol.py.

157 def arg_rev(self) -> Optional[str]:
158 if self.rev is None:
159 return self.vc_class.default_arg_rev
160
161 return self.rev
162

References RevOptions.rev, and RevOptions.vc_class.

Referenced by RevOptions.to_args().

Here is the caller graph for this function:

◆ make_new()

"RevOptions" make_new (   self,
str  rev 
)
Make a copy of the current instance, but with a new rev.

Args:
  rev: the name of the revision for the new object.

Definition at line 181 of file versioncontrol.py.

181 def make_new(self, rev: str) -> "RevOptions":
182 """
183 Make a copy of the current instance, but with a new rev.
184
185 Args:
186 rev: the name of the revision for the new object.
187 """
188 return self.vc_class.make_rev_options(rev, extra_args=self.extra_args)
189
190

References RevOptions.extra_args, and RevOptions.vc_class.

◆ to_args()

CommandArgs to_args (   self)
Return the VCS-specific command arguments.

Definition at line 163 of file versioncontrol.py.

163 def to_args(self) -> CommandArgs:
164 """
165 Return the VCS-specific command arguments.
166 """
167 args: CommandArgs = []
168 rev = self.arg_rev
169 if rev is not None:
170 args += self.vc_class.get_base_rev_args(rev)
171 args += self.extra_args
172
173 return args
174

References RevOptions.arg_rev(), RevOptions.extra_args, and RevOptions.vc_class.

Here is the call graph for this function:

◆ to_display()

str to_display (   self)

Definition at line 175 of file versioncontrol.py.

175 def to_display(self) -> str:
176 if not self.rev:
177 return ""
178
179 return f" (to revision {self.rev})"
180

References RevOptions.rev.

Field Documentation

◆ extra_args

extra_args

Definition at line 148 of file versioncontrol.py.

Referenced by RevOptions.make_new(), and RevOptions.to_args().

◆ rev

rev

Definition at line 149 of file versioncontrol.py.

Referenced by RevOptions.arg_rev(), and RevOptions.to_display().

◆ vc_class

vc_class

Definition at line 150 of file versioncontrol.py.

Referenced by RevOptions.arg_rev(), RevOptions.make_new(), and RevOptions.to_args().


The documentation for this class was generated from the following file: