}        // GetFileStatus

        /// <summary>
        /// Create a VersionInfo from a LocalStatus
        /// </summary>
        private static VersionInfo CreateNode(LocalStatus status, Repository repo)
        {
            VersionStatus rs = VersionStatus.Unversioned;
            Revision      rr = null;

            // Console.WriteLine ("Creating node for status {0}", status.Filename);

            VersionStatus vstatus = ConvertStatus(status.Status);
            // System.Console.WriteLine ("Converted {0} to {1} for {2}", status.Status, vstatus, status.Filename);

            VersionInfo ret = new VersionInfo(status.Filename, Path.GetFullPath(status.Filename), Directory.Exists(status.Filename),
                                              vstatus, new MercurialRevision(repo, status.Revision),
                                              rs, rr);

            return(ret);
        }        // CreateNode
        public override System.Collections.Generic.IEnumerable <LocalStatus> Status(string path, MercurialRevision revision)
        {
            List <LocalStatus> statuses = new List <LocalStatus> ();
            string             rev      = string.Empty;
            ItemStatus         itemStatus;
            LocalStatus        mystatus = null;
            LocalStatus        tmp;
            bool modified = false;


            path = NormalizePath(Path.GetFullPath(path).Replace("{", "{{").Replace("}", "}}"), false);                // escape for string.format

            if (null != revision && MercurialRevision.HEAD != revision.Rev && MercurialRevision.NONE != revision.Rev)
            {
                rev = string.Format(",change={0}", revision.Rev);
            }

            string statusText = string.Empty;

            try {
                statusText = RunMercurialRepoCommand(path, "commands.status(repo.ui,repo,os.path.realpath('{0}'),all=True{1})\n", path, rev);
            } catch (MercurialClientException) {
                // TODO: This happens on incoming/outgoing - handle this in a better way
                LoggingService.LogWarning("Error getting status for {0} at {1}", path, revision.Rev);
            }

            foreach (string line in statusText.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))
            {
                string[] tokens = line.Split(new[] { ' ' }, 2);
                itemStatus = (ItemStatus)tokens[0][0];
                // Console.WriteLine ("Got status {0} for path {1}", tokens[0], tokens[1]);
                tmp = new LocalStatus(string.Empty, NormalizePath(tokens[1]), itemStatus);
                statuses.Add(tmp);
                if (itemStatus != ItemStatus.Ignored && itemStatus != ItemStatus.Unversioned && itemStatus != ItemStatus.Unchanged)
                {
                    modified = true;
                }
                if (Path.GetFileName(path).Equals(Path.GetFileName(tokens[1]), StringComparison.OrdinalIgnoreCase))
                {
                    mystatus = tmp;
                }
            }

            string conflictText = RunMercurialRepoCommand(path, "commands.resolve(repo.ui,repo,os.path.realpath('{0}'),list=True)", path);

            // System.Console.WriteLine (conflictText);
            foreach (string line in conflictText.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))
            {
                string[] tokens = line.Split(new[] { ' ' }, 2);
                itemStatus = (ItemStatus)tokens[0][0];
                if (ItemStatus.Conflicted == itemStatus)
                {
                    LocalStatus status = statuses.Find((s) =>
                                                       s.Filename.EndsWith(tokens[1], StringComparison.OrdinalIgnoreCase)
                                                       );
                    if (null == status)
                    {
                        statuses.Add(new LocalStatus(MercurialRevision.HEAD, tokens[1], ItemStatus.Conflicted));
                    }
                    else
                    {
                        status.Status = ItemStatus.Conflicted;
                    }
                }
//				Console.WriteLine ("Got status {0} for path {1}", tokens[0], tokens[1]);
            }

            if (null == mystatus)
            {
                statuses.Insert(0, new LocalStatus(string.Empty, GetLocalBasePath(path), modified? ItemStatus.Modified: ItemStatus.Unchanged));
            }

            return(statuses);
        }