In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to use Rugged::Reference and Rugged::Branch classes". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use Rugged::Reference and Rugged::Branch classes.
Rugged::Reference class
Reference can be Branch,Remote Branch, Tag, AnnotationTag or point to other Reference, each Reference points to a target, the target can be a Reference, or AnnotationTag, in this case Reference.type=:symbolic, if target is a Commit, then Reference.type=: direct
A) get the Rugged::Reference object
Refs = repo.references#Rugged::ReferenceCollection ref = refs ["ref_name"] refs.each# iteration refs.each_name# iterate refs.exist by name? (name) # does refs.exists exist? (name) # does it exist
B) basic methodology
Valid_name? (ref_name)-> true or false
Check whether reference name is well-formed (well-constructed)
Peel-> oid
??
Name canonical_name
Get the name of the reference
Type->: symbolic or: direct
Get the type of reference
Target ref1.type # = > symbolic ref.1.target = > # ref1.target_id # = > "refs/heads/master" ref2.type # = >: direct ref2.target # = > # ref2.target_id # = > "de5ba987198bcf2518885f0fc1350e5172cded78"
Gets the target and target_id to point to. If reference is a symbolic reference, the target reference object is returned. If the reference is a direct reference, the target object.
Resolve-> peeled_ref r1.type # = >: symbolic r1.name # = > 'HEAD' r1.target # = >' refs/heads/master' R2 = r1.resolve # = > # r2.target # = > '9d09060c850defbc7711d08b57def0d14e742f4e'
Get the target reference pointed to by symbolic reference
Branch?- > true or false
Determine whether the current reference is a local branch
Remote?-> true or false
Determine whether the current reference is a remote branch
Tag?-> true or false
Determine whether the current reference is a tag
Log log? -> true or false-- whether there is reflog reference.log # = > [# {#: id_old = > nil,-- change the previous oid #: id_new = > '9d09060c850defbc7711d08b57def0d14e742f4eforth,-- New oid #: committer = > {: name = >' Vicent Marti',: email = > {'vicent@github.com'}, #: message = >' created reference' #},...]
2. Rugged::Branch class (inheriting Rugged::Reference)
A) get the Rugged::Branch object
Branches = repo.branches # Rugged::BranchCollection branch = branches ["branch_name"] branch.each brach.each_name
B) basic methodology
= (other)
Judge whether two branches are equal or not
Head? → true or false
Whether the HEAD points to the current branch
Name → string
Get the branch name
Remote_name → string
Get the remote name to which the branch belongs
Remote ()
Get the remote of the current branch
Upstream → branch upstream = branch
Gets and sets the remote trace branch. The parameter branch is Rugged::Branch or the Rugged::Reference.
3. Rugged::Tag class (inheriting Rugged::Reference)
A) get the Rugged::Tag object
Tags = repo.tags # Rugged::TagCollection tag = tags ["tag_name"] tags.each tags.each_name
B) basic methodology
Message # = > "Release v0.16.0, codename 'broken stuff'"
Get the message of tag
Name # = > "v0.16.0"
Get tag name
Tagger # = > {: email= > "tanoku@gmail.com",: time= > Tue Jan 24 05:42:45 UTC 2012,: name= > "Vicent Mart\ 303\ 255"}
Get the author signature (signature) of tag
Target_oid # = > "2cb831a8aea28b2c1b9c63385585b864e4d3bad1" target_id # = > "2cb831a8aea28b2c1b9c63385585b864e4d3bad1"
Get the oid that points to the object
Type # = >: blob,:commit,:tree,:tag
Get the type that points to the object
Target-> git_object
Get the target pointed to by tag
At this point, I believe you have a deeper understanding of "how to use Rugged::Reference and Rugged::Branch classes". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.