File tree Expand file tree Collapse file tree 1 file changed +22
-10
lines changed Expand file tree Collapse file tree 1 file changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,26 @@ public virtual string UpstreamBranchCanonicalName
153153 }
154154 }
155155
156+ /// <summary>
157+ /// Get the name of the remote for the branch.
158+ /// <para>
159+ /// If this is a local branch, this will return the configured
160+ /// <see cref="Remote"/> to fetch from and push to. If this is a
161+ /// remote-tracking branch, this will return the name of the remote
162+ /// containing the tracked branch. If there no tracking information
163+ /// this will return null.
164+ /// </para>
165+ /// </summary>
166+ public virtual string RemoteName
167+ {
168+ get
169+ {
170+ return IsRemote
171+ ? RemoteNameFromRemoteTrackingBranch ( )
172+ : RemoteNameFromLocalBranch ( ) ;
173+ }
174+ }
175+
156176 /// <summary>
157177 /// Get the remote for the branch.
158178 /// <para>
@@ -162,20 +182,12 @@ public virtual string UpstreamBranchCanonicalName
162182 /// the tracked branch.
163183 /// </para>
164184 /// </summary>
185+ [ Obsolete ( "This property is deprecated. Use Repository.Network.Remotes[] using the RemoteName property" ) ]
165186 public virtual Remote Remote
166187 {
167188 get
168189 {
169- string remoteName ;
170-
171- if ( IsRemote )
172- {
173- remoteName = RemoteNameFromRemoteTrackingBranch ( ) ;
174- }
175- else
176- {
177- remoteName = RemoteNameFromLocalBranch ( ) ;
178- }
190+ string remoteName = RemoteName ;
179191
180192 if ( remoteName == null )
181193 {
You can’t perform that action at this time.
0 commit comments