hg
author Martin von Zweigbergk <martinvonz@google.com>
Sat, 04 Apr 2015 21:54:12 -0700
branchstable
changeset 24621 1784ca148392
parent 21812 73e4a02e6d23
child 29172 2ea9c9aa6e60
permissions -rwxr-xr-x
dirstate.walk: don't report same file stat multiple times dirstate.walk() generates pairs of filename and a stat-like object. After "hg mv foo Foo", it generates one pair for "foo" and one for "Foo", as it should. However, on case-insensitive file systems, when it tries to stat to get the disk state as well, it gets the same stat result for both names. This confuses at least scmutil._interestingfiles(), making it think that "foo" was forgotten rather than removed. That, in turn, makes "hg addremove" add "foo" back, resulting in both cases in the dirstate, as reported in issue4590. This change only takes care of the "if unknown" branch. A similar fix should perhaps be applied to the other branch.

#!/usr/bin/env python
#
# mercurial - scalable distributed SCM
#
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

import os
import sys

if os.environ.get('HGUNICODEPEDANTRY', False):
    reload(sys)
    sys.setdefaultencoding("undefined")


libdir = '@LIBDIR@'

if libdir != '@' 'LIBDIR' '@':
    if not os.path.isabs(libdir):
        libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                              libdir)
        libdir = os.path.abspath(libdir)
    sys.path.insert(0, libdir)

# enable importing on demand to reduce startup time
try:
    from mercurial import demandimport; demandimport.enable()
except ImportError:
    import sys
    sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
                     ' '.join(sys.path))
    sys.stderr.write("(check your install and PYTHONPATH)\n")
    sys.exit(-1)

import mercurial.util
import mercurial.dispatch

for fp in (sys.stdin, sys.stdout, sys.stderr):
    mercurial.util.setbinary(fp)

mercurial.dispatch.run()