Пример #1
0
        private static T ValueOrDefault <T>(ConfigurationEntry <T> value, Func <T> defaultValueSelector)
        {
            Ensure.ArgumentNotNull(defaultValueSelector, "defaultValueSelector");

            return(value == null
                       ? defaultValueSelector()
                       : value.Value);
        }
Пример #2
0
        private string UpstreamBranchCanonicalNameFromLocalBranch()
        {
            ConfigurationEntry <string> mergeRefEntry = repo.Config.Get <string>("branch", Name, "merge");

            if (mergeRefEntry == null)
            {
                return(null);
            }

            return(mergeRefEntry.Value);
        }
Пример #3
0
        private string RemoteNameFromLocalBranch()
        {
            ConfigurationEntry <string> remoteEntry = repo.Config.Get <string>("branch", Name, "remote");

            if (remoteEntry == null)
            {
                return(null);
            }

            string remoteName = remoteEntry.Value;

            if (string.IsNullOrEmpty(remoteName) ||
                string.Equals(remoteName, ".", StringComparison.Ordinal))
            {
                return(null);
            }

            return(remoteName);
        }
Пример #4
0
 private static T ValueOrDefault <T>(ConfigurationEntry <T> value, T defaultValue)
 {
     return(value == null ? defaultValue : value.Value);
 }