protected Transport(Repository local, URIish uri) { _optionUploadPack = RemoteConfig.DEFAULT_UPLOAD_PACK; _optionReceivePack = RemoteConfig.DEFAULT_RECEIVE_PACK; FetchThin = DEFAULT_FETCH_THIN; PushThin = DEFAULT_PUSH_THIN; _tagopt = TagOpt.NO_TAGS; _fetchSpecs = new List <RefSpec>(); _pushSpecs = new List <RefSpec>(); _local = local; _uri = uri; }
/// <summary> /// Parse a remote block from an existing configuration file. /// <para/> /// This constructor succeeds even if the requested remote is not defined /// within the supplied configuration file. If that occurs then there will be /// no URIs and no ref specifications known to the new instance. /// </summary> /// <param name="rc"> /// the existing configuration to get the remote settings from. /// The configuration must already be loaded into memory. /// </param> /// <param name="remoteName">subsection key indicating the name of this remote.</param> public RemoteConfig(Config rc, string remoteName) { if (rc == null) { throw new ArgumentNullException("rc"); } Name = remoteName; oldName = Name; string[] vlst = rc.getStringList(Section, Name, KeyUrl); URIs = new List <URIish>(vlst.Length); foreach (string s in vlst) { URIs.Add(new URIish(s)); } vlst = rc.getStringList(Section, Name, KeyPushurl); PushURIs = new List <URIish>(vlst.Length); foreach (string s in vlst) { PushURIs.Add(new URIish(s)); } vlst = rc.getStringList(Section, Name, KeyFetch); Fetch = new List <RefSpec>(vlst.Length); foreach (string s in vlst) { Fetch.Add(new RefSpec(s)); } vlst = rc.getStringList(Section, Name, KeyPush); Push = new List <RefSpec>(vlst.Length); foreach (string s in vlst) { Push.Add(new RefSpec(s)); } string val = rc.getString(Section, Name, KeyUploadpack) ?? DEFAULT_UPLOAD_PACK; UploadPack = val; val = rc.getString(Section, Name, KeyReceivepack) ?? DEFAULT_RECEIVE_PACK; ReceivePack = val; val = rc.getString(Section, Name, KeyTagopt); TagOpt = TagOpt.fromOption(val); Mirror = rc.getBoolean(Section, Name, KeyMirror, DefaultMirror); Timeout = rc.getInt(Section, Name, KeyTimeout, 0); }
/// <summary> /// Set the description of how annotated tags should be treated on fetch. /// </summary> /// <param name="option">method to use when handling annotated tags.</param> public void SetTagOpt(TagOpt option) { TagOpt = option ?? TagOpt.AUTO_FOLLOW; }
protected Transport(Repository local, URIish uri) { _optionUploadPack = RemoteConfig.DEFAULT_UPLOAD_PACK; _optionReceivePack = RemoteConfig.DEFAULT_RECEIVE_PACK; FetchThin = DEFAULT_FETCH_THIN; PushThin = DEFAULT_PUSH_THIN; _tagopt = TagOpt.NO_TAGS; _fetchSpecs = new List<RefSpec>(); _pushSpecs = new List<RefSpec>(); _local = local; _uri = uri; }
public void SetTagOpt(TagOpt option) { TagOpt = option ?? TagOpt.AUTO_FOLLOW; }
private void executeImp(ProgressMonitor monitor, FetchResult result) { _connection = _transport.openFetch(); try { result.SetAdvertisedRefs(_transport.Uri, _connection.RefsMap); HashSet <Ref> matched = new HashSet <Ref>(); foreach (RefSpec spec in _toFetch) { if (spec.Source == null) { throw new TransportException("Source ref not specified for refspec: " + spec); } if (spec.Wildcard) { expandWildcard(spec, matched); } else { expandSingle(spec, matched); } } ICollection <Ref> additionalTags = new Collection <Ref>(); TagOpt tagopt = _transport.TagOpt; if (tagopt == TagOpt.AUTO_FOLLOW) { additionalTags = expandAutoFollowTags(); } else if (tagopt == TagOpt.FETCH_TAGS) { expandFetchTags(); } bool includedTags; if (_askFor.Count != 0 && !askForIsComplete()) { fetchObjects(monitor); includedTags = _connection.DidFetchIncludeTags; // Connection was used for object transfer. If we // do another fetch we must open a new connection. // closeConnection(); } else { includedTags = false; } if (tagopt == TagOpt.AUTO_FOLLOW && additionalTags.Count != 0) { // There are more tags that we want to follow, but // not all were asked for on the initial request. foreach (ObjectId key in _askFor.Keys) { _have.Add(key); } _askFor.Clear(); foreach (Ref r in additionalTags) { ObjectId id = r.PeeledObjectId; if (id == null || _transport.Local.HasObject(id)) { wantTag(r); } } if (_askFor.Count != 0 && (!includedTags || !askForIsComplete())) { reopenConnection(); if (_askFor.Count != 0) { fetchObjects(monitor); } } } } finally { closeConnection(); } using (RevWalk.RevWalk walk = new RevWalk.RevWalk(_transport.Local)) { if (_transport.RemoveDeletedRefs) { deleteStaleTrackingRefs(result, walk); } foreach (TrackingRefUpdate u in _localUpdates) { try { u.Update(walk); result.Add(u); } catch (IOException err) { throw new TransportException("Failure updating tracking ref " + u.LocalName + ": " + err.Message, err); } } } if (_fetchHeadUpdates.Count != 0) { try { updateFETCH_HEAD(result); } catch (IOException err) { throw new TransportException("Failure updating FETCH_HEAD: " + err.Message, err); } } }