Exemplo n.º 1
0
        private static T ValueOrDefault <T>(ConfigurationEntry <T> value, Func <T> defaultValueSelector)
        {
            Ensure.ArgumentNotNull(defaultValueSelector, "defaultValueSelector");

            return(value == null
                       ? defaultValueSelector()
                       : value.Value);
        }
Exemplo n.º 2
0
        private string UpstreamBranchCanonicalNameFromLocalBranch()
        {
            ConfigurationEntry <string> mergeRefEntry = repo.Config.Get <string>("branch", Name, "merge");

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

            return(mergeRefEntry.Value);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 private static T ValueOrDefault <T>(ConfigurationEntry <T> value, T defaultValue)
 {
     return(value == null ? defaultValue : value.Value);
 }