[PATCH 2 of 2] Add tests for Largefiles Extension

Na'Tosha Bard natosha at unity3d.com
Sat Sep 24 10:44:20 CDT 2011


# HG changeset patch
# User Na'Tosha Bard <natosha at unity3d.com>
# Date 1316878591 -7200
# Node ID a3d92a9d56d54f3db7a7e3ad8a1f0c11be4e0d5e
# Parent  fee6dc9ed4e6e900457aa1739d68fbbc46d00fdb
Add tests for Largefiles Extension.

diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/README
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/README	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,4 @@
+To run the tests, you need a copy of the Mercurial source code.  While in the 
+largefiles test directory, run
+
+    python <path to Mercurial source directory>/tests/run-tests.py
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/common.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/common.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,232 @@
+import sys
+import os
+import stat
+import subprocess
+import re
+
+import hgtest
+
+# assumes we're run by hg's run-tests.py
+STOREDIR = os.path.join(os.getcwd(), 'store')
+LARGEFILESPATH = os.path.join(os.getenv('TESTDIR'), '..')
+
+DEFAULTRC = {
+    'extensions': [('largefiles', LARGEFILESPATH),
+                   ('rebase', '')],
+    'largefiles': [('systemcache', os.path.join(os.getcwd(), 'lfilesstore')),],
+    }
+
+def getversion():
+    hgname = 'hg'
+    if os.name == 'nt':
+        for path in os.environ['PATH'].split(';'):
+            if os.path.exists(os.path.join(path, 'hg')):
+                hgname = r'python %s\hg' % path
+                break
+    cmd = [hgname, 'version']
+    child = subprocess.Popen(
+        cmd,
+        stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE,
+        universal_newlines=True)
+    stdout, stderr = child.communicate()
+    versions = re.findall(r'\d+\.\d+(?:\.\d+)?', stdout)
+    parts = [re.match(r'\d+', v).group(0) for v in versions[0].split('.')]
+
+    version = [0, 0, 0]
+    for i, part in enumerate(map(int, parts)):
+        version[i] = part
+    return tuple(version)
+
+version = getversion()
+
+class LfilesTester(hgtest.Tester):
+    def updaterc(self, extraconfig=None):
+        '''Append configuration settings to $HGRCPATH to configure lfiles
+        for the current run, plus any additional settings in extraconfig.
+        extraconfig, if supplied, must be a mapping from section name to
+        list of (key, value) pairs -- the same structure as DEFAULTRC.'''
+        config = DEFAULTRC.copy()
+        if extraconfig:
+            for (section, values) in extraconfig.iteritems():
+                if section in config:
+                    config[section] = list(config[section]) + values
+                else:
+                    config[section] = values
+
+        output = []
+        for section in sorted(config):
+            entries = config[section]
+            output.append('[%s]' % section)
+            for entry in entries:
+                assert len(entry) == 2, \
+                    'a config entry must be an iterable with two items'
+                output.append('%s = %s' % tuple(entry))
+        self.writerc('\n'.join(output) + '\n')
+
+    def walk(self, dir, prune=None, dirs=False):
+        sep = os.path.sep
+        dir = dir.replace('/', sep)
+        result = []
+        prefix = len(dir + sep)
+        for (dirpath, dirnames, filenames) in os.walk(dir):
+            dirpath = dirpath[prefix:]      # trim common leading dir name
+            if dirs and dirpath != '':
+                result.append(dirpath)
+            if prune:
+                dirnames[:] = [name for name in dirnames if name not in prune]
+            dirnames.sort()
+            filenames.sort()
+            result.extend([os.path.join(dirpath, name) for name in filenames])
+
+        return [fn.replace(sep, '/') for fn in result]
+
+    def assertadmin(self, expect):
+        actual = self.walk('.hg/lfiles', prune=['pending', 'committed'])
+        self.assertequals(expect, actual, 'admin files')
+
+    def assertpending(self, expect):
+        actual = self.walk('.hg/lfiles/pending', dirs=True)
+        self.assertequals(expect, actual, 'pending files/dirs')
+
+    def assertcommitted(self, expect):
+        actual = self.walk('.hg/lfiles/committed', dirs=True)
+        self.assertequals(expect, actual, 'committed files/dirs')
+
+    def assertstandins(self, expect):
+        actual = self.walk('.hglfiles')
+        self.assertequals(expect, actual, 'standin files')
+
+    def assertstore(self, expect):
+        actual = self.walk(STOREDIR, dirs=True)
+        self.assertequals(expect, actual, 'store contents')
+
+    def assertdirstate(self, expect):
+        actual = self.walk('.')
+        def excluded(path):
+            return path.startswith('./.hg/') or  path.startswith('./.hglfiles')
+        actual = [x for x in actual if not excluded(x)]
+        self.assertequals(expect, actual, 'working files')
+
+    def assertfile(self, file):
+        self.asserttrue(os.path.isfile(file),
+                        'file %s does not exist' % file)
+
+    def assertfilegone(self, file):
+        self.assertfalse(os.path.isfile(file) or os.path.exists(file),
+                         'file %s exists (should be gone)' % file)
+
+    def assertdirgone(self, dir):
+        self.assertfalse(os.path.isdir(dir) or os.path.exists(dir),
+                        'dir %s exists (should be gone)' % dir)
+
+    def isexec(self, filename):
+        return (os.stat(filename).st_mode & stat.S_IXUSR) != 0
+
+    def assertexec(self, filename):
+        if os.name != 'posix':
+            return
+        self.asserttrue(self.isexec(filename),
+                        '%s is not executable' % filename)
+
+    def assertnotexec(self, filename):
+        self.assertfalse(self.isexec(filename),
+                         '%s is executable' % filename)
+
+    def asserthashes(self):
+        '''assert that all big file hashes are consistent:
+        - contents of .hglfiles/x
+        - contents of .hg/lfiles/latest/x
+        - hash of x
+        '''
+        sep = os.path.sep
+        latestdir = os.path.join('.hg', 'lfiles', 'latest')
+        for lfile in self.walk('.hglfiles'):
+            fhash = sha1(lfile)
+
+            shash = self.readfile(os.path.join('.hglfiles', lfile))[0:40]
+            lhash = self.readfile(os.path.join(latestdir, lfile))[0:40]
+
+            assert shash, "nothing read from file %s" % standin
+            assert lhash, "nothing read from file %s" % lfile
+
+            self.asserttrue(
+                shash == lhash == fhash,
+                "%s: inconsistent hashes:\n"
+                "  standin: %s\n"
+                "  latest:  %s\n"
+                "  file:    %s"
+                % (lfile, shash, lhash, fhash))
+
+    def createstore(self, name):
+        store_tar = self.tjoin(name + '.tar')
+        untar(store_tar)
+
+    def sshstore(self):
+        user = os.environ.get('LOGNAME', os.environ.get('USER'))
+        return "ssh://%s@localhost/%s" % (user, STOREDIR)
+
+# This deliberately does not use mercurial.util.sha1() -- don't want to
+# depend on code that we might be testing.
+try:
+    import hashlib                      # Python >= 2.5
+    _sha1 = hashlib.sha1
+except ImportError:
+    import sha                          # Python 2.4
+    _sha1 = sha.new
+
+def sha1(filename):
+    '''Compute and return the SHA-1 hash of the specified file.'''
+    # XXX assumes the file is small enough to read into memory
+    digester = _sha1()
+    f = open(filename)
+    try:
+        digester.update(f.read())
+        return digester.hexdigest()
+    finally:
+        f.close()
+
+def untar(filename, path='.'):
+    '''Untar the specified tar file in path (current directory by
+    default).'''
+    import tarfile
+    tf = tarfile.TarFile(filename)
+    for info in tf:
+        tf.extract(info, path)
+    tf.close()
+
+def checkdirs(patha, pathb):
+    filesa = []
+    for (dir, dirnames, filenames) in os.walk(patha):
+        for f in filenames:
+            filename = os.path.join(dir,f)[len(patha)+1:]
+            if not filename.startswith('.hg') and not filename.startswith('.hglf'):
+                filesa.append(filename)
+    filesb = []
+    for (dir, dirnames, filenames) in os.walk(pathb):
+        for f in filenames:
+            filename = os.path.join(dir,f)[len(pathb)+1:]
+            if not filename.startswith('.hg') and not filename.startswith('.hglf'):
+                filesb.append(filename)
+
+    filesa.sort()
+    filesb.sort()
+    for (fa, fb) in zip(filesa, filesb):
+        if fa != fb:
+            return False
+            sys.exit()
+        fda = open(os.path.join(patha, fa), 'rb').read()
+        fdb = open(os.path.join(pathb, fb), 'rb').read()
+        if fda != fdb:
+            return False
+        if os.stat(os.path.join(patha, fa)).st_mode != os.stat(os.path.join(pathb, fb)).st_mode:
+            return False
+    return True
+
+def checkrepos(hgt, repo1, repo2, revs):
+    for i in revs:
+        hgt.hg(['up', '-R', repo1, '-r', str(i), '-C'], stdout=hgt.ANYTHING, log=False)
+        hgt.hg(['up', '-R', repo2, '-r', str(i), '-C'], stdout=hgt.ANYTHING, log=False)
+        hgt.asserttrue(checkdirs(repo1, repo2), 'repos dont match at %d' % i)
+    hgt.hg(['up', '-R', repo1, '-C'], stdout=hgt.ANYTHING, log=False)
+    hgt.hg(['up', '-R', repo2, '-C'], stdout=hgt.ANYTHING, log=False)
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/dummyssh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/dummyssh	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+import sys
+import os
+
+os.chdir(os.getenv('TESTTMP'))
+
+if sys.argv[1] != "user at dummy":
+    sys.exit(-1)
+
+os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
+
+log = open("dummylog", "ab")
+log.write("Got arguments")
+for i, arg in enumerate(sys.argv[1:]):
+    log.write(" %d:%s" % (i+1, arg))
+log.write("\n")
+log.close()
+r = os.system(sys.argv[2])
+sys.exit(bool(r))
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/hgtest.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/hgtest.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,241 @@
+"""
+Experimental testing framework for Mercurial and its extensions.
+The goal is to allow tests to be Python scripts rather than shell
+scripts.  They should be:
+  * more portable
+  * possibly faster
+  * much easier to understand and modify
+  * somewhat easier to write
+
+"""
+
+import sys
+import os
+import re
+import atexit
+import subprocess
+import traceback
+
+ANYTHING = re.compile(r'')
+
+class Failure(Exception):
+    pass
+
+class Tester(object):
+    """
+    Default test framework.  Is fairly verbose: writes each announcement
+    and each hg command to stdout.
+    """
+
+    ANYTHING = ANYTHING
+
+    def __init__(self):
+        self.stdout = sys.stdout
+        self.failures = []
+        atexit.register(self._atexit)
+        self.firstannounce = True
+
+    def _atexit(self):
+        if self.failures:
+            sys.stderr.write('%d failures\n' % len(self.failures))
+            sys.exit(1)
+
+    def announce(self, msg):
+        if self.firstannounce:
+            msg = '% ' + msg + '\n'
+            self.firstannounce = False
+        else:
+            msg = '\n% ' + msg + '\n'
+        self.stdout.write(msg)
+        self.stdout.flush()
+
+    def hg(self, args, stdout='', stderr='', status=0, log=True):
+        """
+        Run an hg command and check that it output the specified text to
+        stdout and stderr and returned the specified status.  stdout and
+        stderr may be strings for exact comparison or re pattern objects
+        for a regex comparison.  The constant ANYTHING conveniently
+        matches any output, for when you don't care.
+        """
+
+        # XXX should use exact path to hg
+        # XXX set PYTHONPATH?
+
+        hgname = 'hg'
+        if os.name == 'nt':
+            for path in os.environ['PATH'].split(';'):
+                if os.path.exists(os.path.join(path, 'hg')):
+                    hgname = r'python %s\hg' % path
+                    break
+        cmd = hgname.split(' ') + args
+        if log:
+            self._logcmd(['hg'] + args)
+        child = subprocess.Popen(
+            cmd,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+            universal_newlines=True)
+
+        actual_stdout, actual_stderr = child.communicate()
+        actual_status = child.returncode
+        if os.name == 'nt' and actual_status < 0:
+            # hack to match my Unix-centric expected status
+            # (Mercurial actually exits with status -1, and the signedness
+            # is preserved in Windows but wrapped around to 255 on Unix)
+            actual_status += 256
+
+        self.assertoutput(stdout, actual_stdout, 'stdout', cmd)
+        self.assertoutput(stderr, actual_stderr, 'stderr', cmd)
+        if isinstance(status, list):
+            self.asserttrue(actual_status in status, "Status doesn't match")
+        else:
+            self.assertequals(status, actual_status)
+        #self._failearly()
+
+    def tjoin(self, *path):
+        '''Return the path to filename in $TESTDIR.'''
+        return os.path.join(os.environ['TESTDIR'], *path)
+
+    def writefile(self, filename, content, mode='w'):
+        '''Write content to filename.  By default, clobber the file and
+        write in text mode; override mode to append and/or write in
+        binary mode.'''
+        dirname = os.path.dirname(filename)
+        if dirname != '' and not os.path.exists(dirname):
+            os.makedirs(dirname)
+
+        f = open(filename, mode)
+        try:
+            f.write(content)
+        finally:
+            f.close()
+
+    def writerc(self, content):
+        '''Append content to the file specified by HGRCPATH.'''
+        self.writefile(os.environ['HGRCPATH'], content, mode='a')
+
+    def readfile(self, filename, mode='r'):
+        f = open(filename, mode)
+        try:
+            return f.read()
+        finally:
+            f.close()
+
+    def assertfalse(self, test, msg):
+        if test:
+            self._fail(msg)
+
+    def asserttrue(self, test, msg):
+        if not test:
+            self._fail(msg)
+
+    def assertequals(self, expect, actual, prefix=''):
+        if expect != actual:
+            if prefix:
+                prefix += ': '
+            if isinstance(expect, list):
+                msg = self._listfailure(expect, actual, prefix)
+            else:
+                msg = prefix + self._shortfailure(expect, actual)
+            self._fail(msg)
+
+    def assertoutput(self, expect, actual, label, cmd):
+        '''Assert that the actual output (stdout or stderr) of cmd matches
+        the expected output.'''
+        filtered = self._filteroutput(actual)
+        if self._stringmatch(expect, filtered):
+            # silence is golden, so say nothing on success
+            return
+
+        msg = self._bannerbracket(
+            '%s %s:' % ('expected', label),
+            str(expect),
+            '%s %s:' % ('actual (filtered)', label),
+            str(filtered))
+        self._fail(msg)
+
+    # -- Internal methods ----------------------------------------------
+
+    def _shortfailure(self, expect, actual):
+        return 'expected %r, but got %r' % (expect, actual)
+
+    def _listfailure(self, expect, actual, prefix):
+        return self._bannerbracket(
+            '%s%s:' % (prefix, 'expected'),
+            '\n'.join(['  %r' % v for v in expect]) + '\n',
+            '%s%s:' % (prefix, 'actual'),
+            '\n'.join(['  %r' % v for v in actual]) + '\n')
+
+    def _bannerbracket(self, label1, content1, label2, content2):
+        banner1 = ('-- %s ' % label1).ljust(60, '-')
+        banner2 = ('-- %s ' % label2).ljust(60, '-')
+        return ('\n' +
+                banner1 + '\n' +
+                content1 +
+                banner2 + '\n' +
+                content2 +
+                '-'*60)
+
+
+    def _fail(self, msg):
+        self.stdout.write('FAIL: %s\n' % msg)
+
+        # print a stack trace up to the point where we entered this module
+        sys.stdout.write('failure context:\n')
+        stack = traceback.extract_stack()
+        modfile = sys.modules[__name__].__file__
+        modfile = re.sub(r'\.py[co]$', '.py', modfile)
+        while stack[-1][0] == modfile:
+            del stack[-1]
+        for line in traceback.format_list(stack):
+            sys.stdout.write(line)
+
+        self.failures.append(msg)
+
+    def _failearly(self):
+        if self.failures:
+            raise Failure()
+
+    try:
+        re_type = re._pattern_type      # Python 2.5 and up
+    except AttributeError:
+        re_type = type(re.compile(''))  # Python 2.4
+
+    def _stringmatch(self, expect, actual):
+        if isinstance(expect, self.re_type):
+            return bool(expect.search(actual))
+        else:
+            return expect == actual
+
+    unsafechars = re.compile(r'[^a-zA-Z0-9\-\_\+\.\/\=\:]')
+
+    def _logcmd(self, cmd):
+        vcmd = []
+        sep = os.path.sep
+        unix = (sep == '/')
+        for arg in cmd:
+            if not unix and sep in arg:
+                arg = arg.replace(sep, '/')
+            if self.unsafechars.search(arg):
+                arg = '\'' + arg.replace('\'', '\\\'') + '\''
+            for var in ('TESTDIR', 'HGTMP'):
+                val = os.environ[var].replace(sep, '/')
+                arg = arg.replace(val, '$' + var)
+            vcmd.append(arg)
+        self.stdout.write(' '.join(vcmd) + '\n')
+        self.stdout.flush()
+
+    def _filteroutput(self, output):
+        '''Filter Mercurial output to match test expectations.
+        - convert local path separator to Unix
+        - replace occurences of TESTDIR and HGTMP with pseudo-variable
+          expansion
+        '''
+        sep = os.path.sep
+        unix = (sep == '/')
+        if not unix and sep in output:
+            output = output.replace(sep, '/')
+        for var in ('TESTDIR', 'HGTMP'):
+            val = os.environ[var].replace(sep, '/')
+            output = output.replace(val, '$' + var)
+        return output
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-add.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-add.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,118 @@
+#!/usr/bin/env python
+
+# Test various tricky bfadd corner cases.
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+def rejoin(path):
+    '''convert unix path to local convention'''
+    return os.path.join(*path.split('/'))
+
+# add size and patterns for adding as a largefiles
+hgt.updaterc({'largefiles': [('size', '2'), ('patterns', 'glob:**.dat')]})
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init', '-q'])
+hgt.writefile('normal1', 'foo')
+os.mkdir('sub')
+hgt.writefile('sub/normal2', 'bar')
+hgt.hg(['add', '-q', 'normal1', rejoin('sub/normal2')])
+hgt.hg(['commit', '-m', 'add normal files'])
+
+hgt.announce('add existing normal files')
+hgt.hg(['add', '--large', 'normal1', rejoin('sub/normal2')],
+       stderr=('normal1 already tracked!\n'
+               'sub/normal2 already tracked!\n'))
+hgt.hg(['status'], stdout='')           # clean
+
+hgt.writefile('big1', 'abc')
+hgt.writefile('sub/big2', 'xyz')
+hgt.announce('add lfiles')
+hgt.hg(['add', '--large', 'big1', rejoin('sub/big2')])
+hgt.asserttrue(os.path.exists('.hglf/big1'), 'standin exists')
+hgt.asserttrue(os.path.exists('.hglf/sub/big2'), 'standin exists')
+hgt.hg(['status'], stdout='A big1\nA sub/big2\n')
+hgt.hg(['commit', '-m', 'added lfiles'])
+
+hgt.announce('add existing lfiles')
+hgt.hg(['add', '--large', 'big1', rejoin('sub/big2')],
+        stderr='big1 already a largefile\nsub/big2 already a largefile\n')
+hgt.hg(['status'], stdout='')           # clean
+
+hgt.announce('recursive add on existing subdirectory')
+os.mkdir(rejoin('sub/deep'))
+hgt.writefile(rejoin('sub/big3'), '1\n')
+hgt.writefile(rejoin('sub/big4'), '2\n')
+hgt.writefile(rejoin('sub/deep/big5'), '3\n')
+hgt.hg(['add', '--large', '-v', 'sub'],
+       stdout=('adding sub/big3 as a largefile\n'
+               'adding sub/big4 as a largefile\n'
+               'adding sub/deep/big5 as a largefile\n'))
+hgt.hg(['status'],
+       stdout=('A sub/big3\n'
+               'A sub/big4\n'
+               'A sub/deep/big5\n'))
+hgt.hg(['commit', '-m', 'Add a whole subdir of largefiles'])
+
+hgt.announce('status after committing an add')
+hgt.hg(['status'], stdout='')           # clean
+
+hgt.announce('adding lfiles and normal files with hgrc settings')
+os.mkdir('dir')
+hgt.writefile(rejoin('dir/small'), 'small')
+hgt.writefile(rejoin('dir/dict.dat'), 'dictionary')
+hgt.writefile(rejoin('dir/blah.dat'), 'foo')
+hgt.writefile(rejoin('dir/foo'), 'normal')
+hgt.writefile(rejoin('dir/bigfile'), 'a'*(1024*1024*3))
+hgt.hg(['add', 'dir'],
+        stdout=('adding dir/bigfile as a largefile\n'
+             'adding dir/blah.dat as a largefile\n'
+             'adding dir/dict.dat as a largefile\n'
+             'adding dir/foo\n'
+             'adding dir/small\n'))
+hgt.hg(['status'],
+        stdout=('A dir/bigfile\n'
+             'A dir/blah.dat\n'
+             'A dir/dict.dat\n'
+             'A dir/foo\n'
+             'A dir/small\n'))
+hgt.hg(['commit', '-m', 'Added some stuff'])
+
+hgt.announce('adding lfiles and normal files with size setting')
+os.mkdir('dir2')
+hgt.writefile(rejoin('dir2/small'), 'small')
+hgt.writefile(rejoin('dir2/dict.dat'), 'dictionary')
+hgt.writefile(rejoin('dir2/blah.dat'), 'foo')
+hgt.writefile(rejoin('dir2/foo'), 'normal')
+hgt.writefile(rejoin('dir2/bigfile'), 'a'*(1024*1024*3))
+hgt.hg(['add', '--lfsize', '10', 'dir2'],
+        stdout=('adding dir2/blah.dat as a largefile\n'
+             'adding dir2/dict.dat as a largefile\n'
+             'adding dir2/bigfile\n'
+             'adding dir2/foo\n'
+             'adding dir2/small\n'))
+hgt.hg(['status'],
+        stdout=('A dir2/bigfile\n'
+             'A dir2/blah.dat\n'
+             'A dir2/dict.dat\n'
+             'A dir2/foo\n'
+             'A dir2/small\n'))
+hgt.hg(['commit', '-m', 'Added some stuff'])
+
+hgt.writefile('blah.dat', 'stuff')
+os.mkdir('dir3')
+os.chdir('dir3')
+hgt.writefile('foo', 'stuff')
+hgt.writefile('bar.dat', 'stuff')
+hgt.hg(['add', 'foo'])
+hgt.hg(['add'],
+        stdout=('adding ../blah.dat as a largefile\n'
+                'adding bar.dat as a largefile\n'))
+hgt.hg(['status'],
+        stdout=('A blah.dat\n'
+                'A dir3/bar.dat\n'
+                'A dir3/foo\n'))
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-add.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-add.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,38 @@
+% setup
+hg init -q
+hg add -q normal1 sub/normal2
+hg commit -m 'add normal files'
+
+% add existing normal files
+hg add --large normal1 sub/normal2
+hg status
+
+% add lfiles
+hg add --large big1 sub/big2
+hg status
+hg commit -m 'added lfiles'
+
+% add existing lfiles
+hg add --large big1 sub/big2
+hg status
+
+% recursive add on existing subdirectory
+hg add --large -v sub
+hg status
+hg commit -m 'Add a whole subdir of largefiles'
+
+% status after committing an add
+hg status
+
+% adding lfiles and normal files with hgrc settings
+hg add dir
+hg status
+hg commit -m 'Added some stuff'
+
+% adding lfiles and normal files with size setting
+hg add --lfsize 10 dir2
+hg status
+hg commit -m 'Added some stuff'
+hg add foo
+hg add
+hg status
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-addremove.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-addremove.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+#
+# Test that addremove cannot be run on largefiles repos
+
+import os
+import common
+
+
+hgt = common.LfilesTester()
+
+hgt.updaterc()
+hgt.announce('test with lfiles')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+hgt.writefile('foo', 'blah')
+hgt.hg(['add', '--large', 'foo'])
+hgt.hg(['addremove'], status=255, stderr='abort: addremove cannot be run on a repo with largefiles\n')
+hgt.hg(['commit', '-m', 'added foo'])
+hgt.hg(['addremove'], status=255, stderr='abort: addremove cannot be run on a repo with largefiles\n')
+
+hgt.announce('test without lfiles')
+hgt.updaterc({'extensions': [('lfiles', '!')]})
+os.chdir('..')
+os.mkdir('repo2')
+os.chdir('repo2')
+hgt.hg(['init'])
+hgt.writefile('foo', 'blah')
+hgt.hg(['add', 'foo'])
+hgt.hg(['addremove'])
+hgt.hg(['commit', '-m', 'added foo'])
+hgt.hg(['addremove'])
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-addremove.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-addremove.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,13 @@
+% test with lfiles
+hg init
+hg add --large foo
+hg addremove
+hg commit -m 'added foo'
+hg addremove
+
+% test without lfiles
+hg init
+hg add foo
+hg addremove
+hg commit -m 'added foo'
+hg addremove
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-archive-r.t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-archive-r.t	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,33 @@
+Setup
+  $ export LARGEFILES='--config extensions.largefiles=$TESTDIR/..'
+  $ export LHG="hg $LARGEFILES"
+
+Make a repo with a few largefile revisions
+  $ $LHG init r1
+  $ cd r1
+  $ echo c1 > f1
+  $ echo c2 > f2
+  $ echo c3 > f3
+  $ $LHG add --large f1 f3
+  $ $LHG add f2
+  $ $LHG ci -m 'add files'
+  $ echo c1:2 > f1
+  $ $LHG ci -m 'modify largefiles'
+  $ echo c3:2 > f3
+  $ $LHG ci -m 'modify largefiles again'
+  $ cd ..
+
+Clone it and archive when needed largefiles are not cached
+  $ $LHG clone r1 r2
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting changed largefiles
+  2 largefiles updated, 0 removed
+  $ $LHG -R r2 archive -r 0 ../archive0
+  $ cd ../archive0
+  $ cat f1
+  c1
+  $ cat f2
+  c2
+  $ cat f3
+  c3
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-archive.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-archive.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+
+# Test various tricky bfadd corner cases.
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+hgt.writefile('normal1', 'foo')
+os.mkdir('sub')
+hgt.writefile('sub/normal2', 'bar')
+hgt.writefile('big1', 'abc')
+hgt.writefile('sub/big2', 'xyz')
+hgt.hg(['add', 'normal1', 'sub/normal2'])
+hgt.hg(['add', '--large', 'big1', 'sub/big2'])
+hgt.hg(['commit', '-m', 'add files'])
+
+hgt.writefile('normal1', 'foo1')
+hgt.writefile('sub/normal2', 'bar1')
+hgt.writefile('big1', 'abc1')
+hgt.writefile('sub/big2', 'xyz1')
+hgt.hg(['commit', '-m', 'edit files'])
+
+hgt.hg(['rm', 'normal1', 'big1'])
+hgt.hg(['commit', '-m', 'remove files'])
+
+hgt.hg(['mv', 'sub/normal2', 'normal1'])
+hgt.hg(['mv', 'sub/big2', 'big1'])
+hgt.hg(['commit', '-m', 'move files'])
+
+hgt.hg(['cp', 'normal1', 'sub/normal2'])
+hgt.hg(['cp', 'big1', 'sub/big2'])
+hgt.hg(['commit', '-m', 'copy files'])
+
+hgt.hg(['archive', '-r', '0', '../archive0'])
+hgt.hg(['archive', '-r', '1', '../archive1'])
+hgt.hg(['archive', '-r', '2', '../archive2'])
+hgt.hg(['archive', '-r', '3', '../archive3'])
+hgt.hg(['archive', '-r', '4', '../archive4'])
+
+os.chdir('../archive0')
+hgt.asserttrue(hgt.readfile('normal1') == 'foo', 'contents dont match')
+hgt.asserttrue(hgt.readfile('sub/normal2') == 'bar', 'contents dont match')
+hgt.asserttrue(hgt.readfile('big1') == 'abc', 'contents dont match')
+hgt.asserttrue(hgt.readfile('sub/big2') == 'xyz', 'contents dont match')
+
+os.chdir('../archive1')
+hgt.asserttrue(hgt.readfile('normal1') == 'foo1', 'contents dont match')
+hgt.asserttrue(hgt.readfile('sub/normal2') == 'bar1', 'contents dont match')
+hgt.asserttrue(hgt.readfile('big1') == 'abc1', 'contents dont match')
+hgt.asserttrue(hgt.readfile('sub/big2') == 'xyz1', 'contents dont match')
+
+os.chdir('../archive2')
+hgt.asserttrue(not os.path.exists('normal1'), 'file should not exist')
+hgt.asserttrue(hgt.readfile('sub/normal2') == 'bar1', 'contents dont match')
+hgt.asserttrue(not os.path.exists('big1'), 'file should not exist')
+hgt.asserttrue(hgt.readfile('sub/big2') == 'xyz1', 'contents dont match')
+
+os.chdir('../archive3')
+hgt.asserttrue(not os.path.exists('sub/normal2'), 'file should not exist')
+hgt.asserttrue(hgt.readfile('normal1') == 'bar1', 'contents dont match')
+hgt.asserttrue(not os.path.exists('sub/big2'), 'file should not exist')
+hgt.asserttrue(hgt.readfile('big1') == 'xyz1', 'contents dont match')
+
+os.chdir('../archive4')
+hgt.asserttrue(hgt.readfile('normal1') == 'bar1', 'contents dont match')
+hgt.asserttrue(hgt.readfile('sub/normal2') == 'bar1', 'contents dont match')
+hgt.asserttrue(hgt.readfile('big1') == 'xyz1', 'contents dont match')
+hgt.asserttrue(hgt.readfile('sub/big2') == 'xyz1', 'contents dont match')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-archive.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-archive.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,19 @@
+% setup
+hg init
+hg add normal1 sub/normal2
+hg add --large big1 sub/big2
+hg commit -m 'add files'
+hg commit -m 'edit files'
+hg rm normal1 big1
+hg commit -m 'remove files'
+hg mv sub/normal2 normal1
+hg mv sub/big2 big1
+hg commit -m 'move files'
+hg cp normal1 sub/normal2
+hg cp big1 sub/big2
+hg commit -m 'copy files'
+hg archive -r 0 ../archive0
+hg archive -r 1 ../archive1
+hg archive -r 2 ../archive2
+hg archive -r 3 ../archive3
+hg archive -r 4 ../archive4
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-backout.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-backout.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,158 @@
+#!/usr/bin/env python
+#
+# Every commit needs time stamps so that the commits are unique (Mercurial backout test
+# does the same thing).
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+def rejoin(path):
+    '''convert unix path to local convention'''
+    return os.path.join(*path.split('/'))
+
+# add size and patterns for adding as a largefiles
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+os.mkdir('dir')
+os.chdir('dir')
+hgt.writefile('n1', 'n1')
+hgt.writefile('n2', 'n2')
+hgt.writefile('dir/n3', 'n3')
+hgt.writefile('dir/dir/n4', 'n4')
+hgt.writefile('b1', 'b1')
+hgt.writefile('b2', 'b2')
+hgt.writefile('dir/b3', 'b3')
+hgt.writefile('dir/dir/b4', 'b4')
+hgt.hg(['add', 'n1', 'n2', 'dir/n3', 'dir/dir/n4'])
+hgt.hg(['add', '--large', 'b1', 'b2', 'dir/b3', 'dir/dir/b4'])
+hgt.hg(['commit', '-m', 'add files', '-d', '0 0'])
+hgt.writefile('n1', 'n11')
+hgt.writefile('dir/dir/n4', 'n44')
+hgt.writefile('b1', 'b11')
+hgt.writefile('dir/dir/b4', 'b44')
+hgt.hg(['commit', '-m', 'edit files', '-d', '1 0'])
+hgt.hg(['remove', 'dir/n3', 'dir/b3'])
+hgt.hg(['commit', '-m', 'remove files', '-d', '2 0'])
+
+hgt.announce('backout')
+hgt.hg(['status', '-A'],
+        stdout='''C dir/b1
+C dir/b2
+C dir/dir/dir/b4
+C dir/dir/dir/n4
+C dir/n1
+C dir/n2
+''')
+hgt.hg(['backout', '2', '-d', '3 0'],
+        stdout='''getting changed largefiles
+0 largefiles updated, 0 removed
+adding ../.hglf/dir/dir/b3
+adding dir/n3
+changeset 3:e81107f51a59 backs out changeset 2:4f96ab858336
+''')
+hgt.hg(['status', '-A'],
+        stdout='''C dir/b1
+C dir/b2
+C dir/dir/b3
+C dir/dir/dir/b4
+C dir/dir/dir/n4
+C dir/dir/n3
+C dir/n1
+C dir/n2
+''')
+hgt.asserttrue(hgt.readfile('dir/n3') == 'n3', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/b3') == 'b3', 'file changed')
+hgt.hg(['backout', '3', '-d', '4 0'],
+        stdout='''getting changed largefiles
+0 largefiles updated, 0 removed
+removing ../.hglf/dir/dir/b3
+removing dir/n3
+changeset 4:166af621a4b3 backs out changeset 3:e81107f51a59
+''')
+hgt.hg(['status', '-A'],
+        stdout='''C dir/b1
+C dir/b2
+C dir/dir/dir/b4
+C dir/dir/dir/n4
+C dir/n1
+C dir/n2
+''')
+hgt.assertfalse(os.path.exists('dir/n3'), 'file shouldnt exist')
+hgt.assertfalse(os.path.exists('dir/b3'), 'file shouldnt exist')
+hgt.announce('backout... from the past!')
+hgt.hg(['backout', '2', '-d', '5 0', '--merge'],
+        stdout='''getting changed largefiles
+0 largefiles updated, 0 removed
+adding ../.hglf/dir/dir/b3
+adding dir/n3
+created new head
+changeset 5:9cb1d8a02b30 backs out changeset 2:4f96ab858336
+getting changed largefiles
+0 largefiles updated, 1 removed
+merging with changeset 5:9cb1d8a02b30
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+getting changed largefiles
+1 largefiles updated, 0 removed
+''')
+hgt.hg(['commit', '-m', 'merge', '-d', '6 0'])
+hgt.hg(['backout', '1', '--merge', '-d', '7 0'],
+        stdout='''getting changed largefiles
+0 largefiles updated, 0 removed
+reverting ../.hglf/dir/b1
+reverting ../.hglf/dir/dir/dir/b4
+reverting dir/dir/n4
+reverting n1
+created new head
+changeset 7:846d81616418 backs out changeset 1:a12f28861c50
+getting changed largefiles
+2 largefiles updated, 0 removed
+merging with changeset 7:846d81616418
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+hgt.asserttrue(hgt.readfile('n1') == 'n1', 'file should match start')
+hgt.asserttrue(hgt.readfile('n2') == 'n2', 'file should match start')
+hgt.asserttrue(hgt.readfile('dir/n3') == 'n3', 'file should match start')
+hgt.asserttrue(hgt.readfile('dir/dir/n4') == 'n4', 'file should match start')
+hgt.asserttrue(hgt.readfile('b1') == 'b1', 'file should match start')
+hgt.asserttrue(hgt.readfile('b2') == 'b2', 'file should match start')
+hgt.asserttrue(hgt.readfile('dir/b3') == 'b3', 'file should match start')
+hgt.asserttrue(hgt.readfile('dir/dir/b4') == 'b4', 'file should match start')
+hgt.hg(['commit', '-m', 'merge', '-d', '8 0'])
+hgt.hg(['up', '-r', '0'],
+        stdout='''4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+0 largefiles updated, 0 removed
+''')
+hgt.asserttrue(hgt.readfile('n1') == 'n1', 'file should match start')
+hgt.asserttrue(hgt.readfile('n2') == 'n2', 'file should match start')
+hgt.asserttrue(hgt.readfile('dir/n3') == 'n3', 'file should match start')
+hgt.asserttrue(hgt.readfile('dir/dir/n4') == 'n4', 'file should match start')
+hgt.asserttrue(hgt.readfile('b1') == 'b1', 'file should match start')
+hgt.asserttrue(hgt.readfile('b2') == 'b2', 'file should match start')
+hgt.asserttrue(hgt.readfile('dir/b3') == 'b3', 'file should match start')
+hgt.asserttrue(hgt.readfile('dir/dir/b4') == 'b4', 'file should match start')
+hgt.hg(['up'],
+        stdout='''4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+0 largefiles updated, 0 removed
+''')
+hgt.asserttrue(hgt.readfile('n1') == 'n1', 'file should match start')
+hgt.asserttrue(hgt.readfile('n2') == 'n2', 'file should match start')
+hgt.asserttrue(hgt.readfile('dir/n3') == 'n3', 'file should match start')
+hgt.asserttrue(hgt.readfile('dir/dir/n4') == 'n4', 'file should match start')
+hgt.asserttrue(hgt.readfile('b1') == 'b1', 'file should match start')
+hgt.asserttrue(hgt.readfile('b2') == 'b2', 'file should match start')
+hgt.asserttrue(hgt.readfile('dir/b3') == 'b3', 'file should match start')
+hgt.asserttrue(hgt.readfile('dir/dir/b4') == 'b4', 'file should match start')
+hgt.writefile('b1', 'b11')
+hgt.hg(['backout', '8', '-d', '9 0'], status=255,
+        stderr='abort: outstanding uncommitted changes\n')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-backout.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-backout.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,24 @@
+% setup
+hg init
+hg add n1 n2 dir/n3 dir/dir/n4
+hg add --large b1 b2 dir/b3 dir/dir/b4
+hg commit -m 'add files' -d '0 0'
+hg commit -m 'edit files' -d '1 0'
+hg remove dir/n3 dir/b3
+hg commit -m 'remove files' -d '2 0'
+
+% backout
+hg status -A
+hg backout 2 -d '3 0'
+hg status -A
+hg backout 3 -d '4 0'
+hg status -A
+
+% backout... from the past!
+hg backout 2 -d '5 0' --merge
+hg commit -m merge -d '6 0'
+hg backout 1 --merge -d '7 0'
+hg commit -m merge -d '8 0'
+hg up -r 0
+hg up
+hg backout 8 -d '9 0'
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-bisect.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-bisect.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,130 @@
+#!/usr/bin/env python
+
+# Test various tricky bfadd corner cases.
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+hgt.writefile('normal1', 'foo')
+os.mkdir('sub')
+hgt.writefile('sub/normal2', 'bar')
+hgt.writefile('big1', 'abc')
+hgt.writefile('sub/big2', 'xyz')
+hgt.hg(['add', 'normal1', 'sub/normal2'])
+hgt.hg(['add', '--large', 'big1', 'sub/big2'])
+hgt.hg(['commit', '-m', 'add files'])
+
+hgt.writefile('normal1', 'foo1')
+hgt.writefile('sub/normal2', 'bar1')
+hgt.writefile('big1', 'abc1')
+hgt.writefile('sub/big2', 'xyz1')
+hgt.hg(['commit', '-m', 'edit files'])
+
+hgt.writefile('normal1', 'foo2')
+hgt.writefile('sub/normal2', 'bar2')
+hgt.writefile('big1', 'abc2')
+hgt.writefile('sub/big2', 'xyz2')
+hgt.hg(['commit', '-m', 'edit files'])
+
+hgt.writefile('normal1', 'foo3')
+hgt.writefile('sub/normal2', 'bar3')
+hgt.writefile('big1', 'abc3')
+hgt.writefile('sub/big2', 'xyz3')
+hgt.hg(['commit', '-m', 'edit files'])
+
+hgt.writefile('normal1', 'foo4')
+hgt.writefile('sub/normal2', 'bar4')
+hgt.writefile('big1', 'abc4')
+hgt.writefile('sub/big2', 'xyz4')
+hgt.hg(['commit', '-m', 'edit files'])
+
+hgt.announce('bisect')
+hgt.hg(['up', '-r', '0', '-q'])
+hgt.hg(['bisect', '-g'])
+hgt.hg(['up', '-q'])
+hgt.hg(['bisect', '-b'],
+    stdout='''Testing changeset 2:cc48633d63ca (4 changesets remaining, ~2 tests)
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+hgt.writefile('big1', 'blah')
+hgt.hg(['bisect', '-g'], stdout='Testing changeset 3:0540e72bd972 (2 changesets remaining, ~1 tests)\n', stderr='abort: outstanding uncommitted changes\n', status=255)
+hgt.hg(['revert', '-a'], stdout='reverting .hglf/big1\n')
+hgt.hg(['bisect', '-g'], stdout='''Testing changeset 3:0540e72bd972 (2 changesets remaining, ~1 tests)
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+hgt.hg(['bisect', '-b'],
+        stdout='''The first bad revision is:
+changeset:   3:0540e72bd972
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     edit files
+
+''')
+hgt.hg(['up'],
+        stdout='''4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+
+hgt.announce('more changes')
+hgt.hg(['mv', 'sub', 'dir'],
+        stdout='''moving sub/normal2 to dir/normal2
+moving .hglf/sub/big2 to .hglf/dir/big2
+''')
+hgt.hg(['commit', '-m', 'move sub to dir'])
+hgt.hg(['rm', 'normal1', 'big1'])
+hgt.hg(['cp', 'dir/normal2', 'normal1'])
+hgt.hg(['cp', 'dir/big2', 'big1'])
+hgt.hg(['commit', '-m', 'remove and copy'])
+
+hgt.announce('bisect again')
+hgt.hg(['bisect', '-r'])
+hgt.hg(['bisect', '-b'])
+hgt.hg(['up', '-r', '1'],
+        stdout='''4 files updated, 0 files merged, 2 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 1 removed
+''')
+hgt.hg(['bisect', '-g'],
+        stdout='''Testing changeset 3:0540e72bd972 (5 changesets remaining, ~2 tests)
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+hgt.hg(['bisect', '-g'],
+        stdout='''Testing changeset 4:b723745fafc3 (3 changesets remaining, ~1 tests)
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+hgt.hg(['bisect', '-g'],
+        stdout='''Testing changeset 5:101b1f3cf520 (2 changesets remaining, ~1 tests)
+2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+getting changed largefiles
+1 largefiles updated, 1 removed
+''')
+hgt.hg(['bisect', '-g'],
+        stdout='''The first bad revision is:
+changeset:   6:1f5d63d1b175
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     remove and copy
+
+''')
+hgt.hg(['up'],
+        stdout='''2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+1 largefiles updated, 0 removed
+''')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-bisect.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-bisect.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,38 @@
+% setup
+hg init
+hg add normal1 sub/normal2
+hg add --large big1 sub/big2
+hg commit -m 'add files'
+hg commit -m 'edit files'
+hg commit -m 'edit files'
+hg commit -m 'edit files'
+hg commit -m 'edit files'
+
+% bisect
+hg up -r 0 -q
+hg bisect -g
+hg up -q
+hg bisect -b
+hg bisect -g
+hg revert -a
+hg bisect -g
+hg bisect -b
+hg up
+
+% more changes
+hg mv sub dir
+hg commit -m 'move sub to dir'
+hg rm normal1 big1
+hg cp dir/normal2 normal1
+hg cp dir/big2 big1
+hg commit -m 'remove and copy'
+
+% bisect again
+hg bisect -r
+hg bisect -b
+hg up -r 1
+hg bisect -g
+hg bisect -g
+hg bisect -g
+hg bisect -g
+hg up
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-clone.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-clone.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,214 @@
+#!/usr/bin/env python
+
+# Test cloning a repo
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+def rejoin(path):
+    '''convert unix path to local convention'''
+    return os.path.join(*path.split('/'))
+
+def assertidentical(hgt, file1, file2):
+    hgt.asserttrue(os.path.exists(file1) == os.path.exists(file2), 'File existence doesnt match')
+    if not os.path.exists(file1):
+        return
+    with open(file1, 'r') as fd:
+        d1 = fd.read()
+    with open(file2, 'r') as fd:
+        d2 = fd.read()
+    hgt.asserttrue(d1 == d2, 'Files differ %s %s %s %s' % (file1, file2, d1, d2))
+
+# add size and patterns for adding as a largefiles
+hgt.updaterc({'largefiles': [('size', '2'), ('patterns', 'glob:**.dat')]})
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init', '-q'])
+hgt.writefile('normal1', 'foo')
+os.mkdir('sub')
+hgt.writefile('sub/normal2', 'bar')
+hgt.writefile('sub/normal3.txt', 'bar2')
+hgt.writefile('sub/normal4.txt', 'bar3')
+hgt.hg(['add', '-q', 'normal1', rejoin('sub/normal2'), rejoin('sub/normal3.txt'), rejoin('sub/normal4.txt')])
+hgt.hg(['commit', '-m', 'add normal files'])
+
+hgt.announce('add lfiles')
+hgt.writefile('big1', 'abc')
+hgt.writefile('sub/big2', 'xyz')
+hgt.writefile('sub/big3.txt', 'xyz')
+hgt.hg(['add', '-q', '--large', 'big1', rejoin('sub/big2'), rejoin('sub/big3.txt')])
+hgt.hg(['commit', '-m', 'added lfiles'])
+
+hgt.announce('edit files')
+hgt.writefile('big1', '123')
+hgt.writefile('sub/big2', '456')
+hgt.writefile('normal1', '789')
+hgt.writefile('sub/normal2', '012')
+hgt.hg(['commit', '-m', 'edited files'])
+
+hgt.announce('clone to repo2')
+os.chdir('..')
+hgt.hg(['clone', 'repo1', 'repo2'],
+        stdout=('updating to branch default\n'
+                '7 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+files = ['normal1', 'sub/normal2', 'sub/normal3.txt', 'sub/normal4.txt', 'big1', 'sub/big2', 'sub/big3.txt']
+for file in files:
+    assertidentical(hgt, os.path.join('repo1', file), os.path.join('repo2', file))
+
+hgt.announce('update to rev 0 and check')
+os.chdir('repo1')
+hgt.hg(['up', '-r', '0'],
+        stdout=('2 files updated, 0 files merged, 3 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '0 largefiles updated, 3 removed\n'))
+os.chdir('../repo2')
+hgt.hg(['up', '-r', '0'],
+        stdout=('2 files updated, 0 files merged, 3 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '0 largefiles updated, 3 removed\n'))
+os.chdir('..')
+for file in files:
+    assertidentical(hgt, os.path.join('repo1', file), os.path.join('repo2', file))
+
+hgt.announce('update to rev 1 and check')
+os.chdir('repo1')
+hgt.hg(['up', '-r', '1'],
+        stdout=('3 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+os.chdir('../repo2')
+hgt.hg(['up', '-r', '1'],
+        stdout=('3 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+os.chdir('..')
+for file in files:
+    assertidentical(hgt, os.path.join('repo1', file), os.path.join('repo2', file))
+
+hgt.announce('update to rev 2 and check')
+os.chdir('repo1')
+hgt.hg(['up', '-r', '2'],
+        stdout=('4 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '2 largefiles updated, 0 removed\n'))
+os.chdir('../repo2')
+hgt.hg(['up', '-r', '2'],
+        stdout=('4 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '2 largefiles updated, 0 removed\n'))
+os.chdir('..')
+for file in files:
+    assertidentical(hgt, os.path.join('repo1', file), os.path.join('repo2', file))
+
+hgt.announce('clone to repo3')
+hgt.hg(['clone', '-U', 'repo2', 'repo3'])
+os.chdir('repo3')
+hgt.hg(['up'], stdout=('7 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+os.chdir('..')
+for file in files:
+    assertidentical(hgt, os.path.join('repo2', file), os.path.join('repo3', file))
+
+hgt.announce('update to rev 0 and check')
+os.chdir('repo2')
+hgt.hg(['up', '-r', '0'],
+        stdout=('2 files updated, 0 files merged, 3 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '0 largefiles updated, 3 removed\n'))
+os.chdir('../repo3')
+hgt.hg(['up', '-r', '0'],
+        stdout=('2 files updated, 0 files merged, 3 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '0 largefiles updated, 3 removed\n'))
+os.chdir('..')
+for file in files:
+    assertidentical(hgt, os.path.join('repo2', file), os.path.join('repo3', file))
+
+hgt.announce('update to rev 1 and check')
+os.chdir('repo2')
+hgt.hg(['up', '-r', '1'],
+        stdout=('3 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+os.chdir('../repo3')
+hgt.hg(['up', '-r', '1'],
+        stdout=('3 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+os.chdir('..')
+for file in files:
+    assertidentical(hgt, os.path.join('repo2', file), os.path.join('repo3', file))
+
+hgt.announce('update to rev 2 and check')
+os.chdir('repo2')
+hgt.hg(['up', '-r', '2'],
+        stdout=('4 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '2 largefiles updated, 0 removed\n'))
+os.chdir('../repo3')
+hgt.hg(['up', '-r', '2'],
+        stdout=('4 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '2 largefiles updated, 0 removed\n'))
+os.chdir('..')
+for file in files:
+    assertidentical(hgt, os.path.join('repo2', file), os.path.join('repo3', file))
+
+os.chdir('repo3')
+hgt.hg(['cp', 'sub', 'dir'],
+        stdout='''copying sub/normal2 to dir/normal2
+copying sub/normal3.txt to dir/normal3.txt
+copying sub/normal4.txt to dir/normal4.txt
+copying .hglf/sub/big2 to .hglf/dir/big2
+copying .hglf/sub/big3.txt to .hglf/dir/big3.txt
+''')
+hgt.hg(['cp', 'dir', 'dir2'],
+        stdout='''copying dir/normal2 to dir2/normal2
+copying dir/normal3.txt to dir2/normal3.txt
+copying dir/normal4.txt to dir2/normal4.txt
+copying .hglf/dir/big2 to .hglf/dir2/big2
+copying .hglf/dir/big3.txt to .hglf/dir2/big3.txt
+''')
+hgt.hg(['commit', '-m', 'copy sub twice'])
+os.chdir('..')
+
+hgt.announce('clone again')
+hgt.hg(['clone', 'repo3', 'repo4', '-U'])
+os.chdir('repo4')
+for file in os.listdir('.'):
+    hgt.asserttrue(file.startswith('.hg'), 'files shouldnt exist')
+hgt.hg(['up'],
+        stdout='''17 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+7 largefiles updated, 0 removed
+''')
+os.chdir('..')
+
+newfiles = files + ['dir/normal2', 'dir/normal3.txt', 'dir/normal4.txt', 'dir/big2','dir/big3.txt']
+newfiles += ['dir2/normal2', 'dir2/normal3.txt', 'dir2/normal4.txt', 'dir2/big2','dir2/big3.txt']
+for file in newfiles:
+    assertidentical(hgt, os.path.join('repo3', file), os.path.join('repo4', file))
+for file in os.listdir('repo3'):
+    hgt.asserttrue(file.startswith('.hg') or file.startswith('.hglf') or file in newfiles + ['sub', 'dir', 'dir2'], 'file shouldnt exist')
+for file in os.listdir('repo4'):
+    hgt.asserttrue(file.startswith('.hg') or file.startswith('.hglf') or file in newfiles + ['sub', 'dir', 'dir2'], 'file shouldnt exist')
+
+os.chdir('repo3')
+hgt.hg(['up', '-r', '2'],
+        stdout='''0 files updated, 0 files merged, 10 files removed, 0 files unresolved
+getting changed largefiles
+0 largefiles updated, 4 removed
+''')
+os.chdir('../repo4')
+hgt.hg(['up', '-r', '2'],
+        stdout='''0 files updated, 0 files merged, 10 files removed, 0 files unresolved
+getting changed largefiles
+0 largefiles updated, 4 removed
+''')
+os.chdir('..')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-clone.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-clone.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,51 @@
+% setup
+hg init -q
+hg add -q normal1 sub/normal2 sub/normal3.txt sub/normal4.txt
+hg commit -m 'add normal files'
+
+% add lfiles
+hg add -q --large big1 sub/big2 sub/big3.txt
+hg commit -m 'added lfiles'
+
+% edit files
+hg commit -m 'edited files'
+
+% clone to repo2
+hg clone repo1 repo2
+
+% update to rev 0 and check
+hg up -r 0
+hg up -r 0
+
+% update to rev 1 and check
+hg up -r 1
+hg up -r 1
+
+% update to rev 2 and check
+hg up -r 2
+hg up -r 2
+
+% clone to repo3
+hg clone -U repo2 repo3
+hg up
+
+% update to rev 0 and check
+hg up -r 0
+hg up -r 0
+
+% update to rev 1 and check
+hg up -r 1
+hg up -r 1
+
+% update to rev 2 and check
+hg up -r 2
+hg up -r 2
+hg cp sub dir
+hg cp dir dir2
+hg commit -m 'copy sub twice'
+
+% clone again
+hg clone repo3 repo4 -U
+hg up
+hg up -r 2
+hg up -r 2
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-commit.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-commit.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+#
+# Test commit (lots of other tests commit all files so just try committing specific files)
+#
+
+import os
+import common
+
+
+hgt = common.LfilesTester()
+
+hgt.updaterc()
+hgt.announce('test')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+os.mkdir('dir')
+os.mkdir('dir/dir')
+hgt.writefile('n1', 'n1')
+hgt.writefile('dir/n2', 'n2')
+hgt.writefile('dir/dir/n3', 'n3')
+hgt.writefile('b1', 'b1')
+hgt.writefile('dir/b2', 'b2')
+hgt.writefile('dir/dir/b3', 'b3')
+hgt.hg(['add', 'n1', 'dir/n2', 'dir/dir/n3'])
+hgt.hg(['add', '--large', 'b1', 'dir/b2', 'dir/dir/b3'])
+hgt.hg(['status'],
+        stdout='''A b1
+A dir/b2
+A dir/dir/b3
+A dir/dir/n3
+A dir/n2
+A n1
+''')
+hgt.hg(['commit', '-m', 'adding', '.hglf/b1'], status=255, stderr="abort: Don't commit largefile standin. Commit largefile.\n")
+hgt.hg(['status'],
+        stdout='''A b1
+A dir/b2
+A dir/dir/b3
+A dir/dir/n3
+A dir/n2
+A n1
+''')
+hgt.hg(['commit', '-m', 'adding', 'n1', 'b1'])
+hgt.hg(['status'],
+        stdout='''A dir/b2
+A dir/dir/b3
+A dir/dir/n3
+A dir/n2
+''')
+hgt.hg(['commit', '-m', 'adding', 'dir/dir/n3', 'dir/dir/b3'])
+hgt.hg(['status'],
+        stdout='''A dir/b2
+A dir/n2
+''')
+hgt.hg(['commit', '-m', 'adding', 'dir/b2', 'dir/n2'])
+hgt.hg(['status'])
+hgt.writefile('b1', 'b11')
+hgt.hg(['status'],
+        stdout='M b1\n')
+hgt.hg(['commit', '-m', 'modifying b1'])
+hgt.asserttrue(hgt.readfile('b1') == 'b11', 'file contents dont match')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-commit.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-commit.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,15 @@
+% test
+hg init
+hg add n1 dir/n2 dir/dir/n3
+hg add --large b1 dir/b2 dir/dir/b3
+hg status
+hg commit -m adding .hglf/b1
+hg status
+hg commit -m adding n1 b1
+hg status
+hg commit -m adding dir/dir/n3 dir/dir/b3
+hg status
+hg commit -m adding dir/b2 dir/n2
+hg status
+hg status
+hg commit -m 'modifying b1'
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-convert.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-convert.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,251 @@
+#!/usr/bin/env python
+
+# Test various tricky bfadd corner cases.
+
+import os
+import common
+
+hgt = common.LfilesTester()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+os.mkdir('dir')
+os.mkdir('dir/a')
+os.mkdir('dir/b')
+os.mkdir('dir/b/c')
+os.mkdir('z')
+hgt.writefile('foo.dat', 'stuffnthings')
+hgt.writefile('foo', 'stuffnthings')
+hgt.writefile('dir/big.dat', 'a'*(1024*1024*3))
+hgt.writefile('dir/big', 'a'*(1024*1024*3))
+hgt.writefile('dir/a/small.dat', 'small')
+hgt.writefile('dir/a/small', 'small')
+hgt.hg(['add'],
+        stdout='''adding dir/a/small
+adding dir/a/small.dat
+adding dir/big
+adding dir/big.dat
+adding foo
+adding foo.dat
+''')
+hgt.hg(['commit', '-m', 'initial commit'])
+hgt.writefile('dir/b/medium.dat', 'b'*(1024*1024))
+hgt.writefile('dir/b/medium', 'b'*(1024*1024))
+hgt.writefile('dir/b/c/foo.dat', 'foo')
+hgt.writefile('dir/b/c/foo', 'foo')
+hgt.writefile('z/bigbig.dat', 'c'*(1024*1024*5))
+hgt.writefile('z/bigbig', 'c'*(1024*1024*5))
+hgt.hg(['add'],
+        stdout='''adding dir/b/c/foo
+adding dir/b/c/foo.dat
+adding dir/b/medium
+adding dir/b/medium.dat
+adding z/bigbig
+adding z/bigbig.dat
+''')
+hgt.hg(['commit', '-m', 'add more files'])
+hgt.writefile('foo.dat', 'stuffnthings2')
+hgt.writefile('foo', 'stuffnthings2')
+hgt.writefile('z/bigbig.dat', 'd'*(1024*1024*5))
+hgt.writefile('z/bigbig', 'd'*(1024*1024*5))
+hgt.hg(['commit', '-m', 'edit some files'])
+hgt.hg(['mv', 'z', 'dir'],
+        stdout='''moving z/bigbig to dir/z/bigbig
+moving z/bigbig.dat to dir/z/bigbig.dat
+''')
+hgt.hg(['commit', '-m', 'move files'])
+hgt.hg(['rm', 'dir/b'],
+        stdout='''removing dir/b/c/foo
+removing dir/b/c/foo.dat
+removing dir/b/medium
+removing dir/b/medium.dat
+''')
+hgt.hg(['commit', '-m', 'remove some files'])
+hgt.hg(['log'],
+        stdout='''changeset:   4:c6ddff0dd76c
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     remove some files
+
+changeset:   3:9769c20e1daa
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     move files
+
+changeset:   2:a73f17a91216
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     edit some files
+
+changeset:   1:73960f5ccfe2
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add more files
+
+changeset:   0:d82117283c29
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     initial commit
+
+''')
+os.chdir('..')
+
+hgt.updaterc()
+hgt.hg(['lfconvert', '-s', '100', 'repo1', 'repo2'],
+        stdout='initializing destination repo2\n')
+
+os.chdir('repo2')
+hgt.hg(['log'], stdout='''changeset:   4:c6ddff0dd76c
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     remove some files
+
+changeset:   3:9769c20e1daa
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     move files
+
+changeset:   2:a73f17a91216
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     edit some files
+
+changeset:   1:73960f5ccfe2
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add more files
+
+changeset:   0:d82117283c29
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     initial commit
+
+''')
+hgt.hg(['up'], stdout='8 files updated, 0 files merged, 0 files removed, 0 files unresolved\n')
+hgt.assertfalse(os.path.exists('.hglf'), "lfile standins shouldn't exist")
+
+os.chdir('..')
+common.checkrepos(hgt, 'repo1', 'repo2', [0, 1, 2, 3, 4])
+
+hgt.updaterc({'largefiles': [('size', '2'), ('patterns', 'glob:**.dat')]})
+hgt.hg(['lfconvert', 'repo1', 'repo3'],
+        stdout='initializing destination repo3\n')
+
+os.chdir('repo3')
+hgt.assertfalse(os.path.exists('.hglf'), 'nothing should exist yet')
+hgt.hg(['log'], stdout='''changeset:   4:d24ab8ed07ab
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     remove some files
+
+changeset:   3:1671627a0341
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     move files
+
+changeset:   2:55cbecf97608
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     edit some files
+
+changeset:   1:1a6cdde29465
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add more files
+
+changeset:   0:47166a08d6ee
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     initial commit
+
+''')
+hgt.hg(['up'],
+        stdout='''8 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+6 largefiles updated, 0 removed
+''')
+hgt.asserttrue(os.path.exists('.hglf'), 'lfile standins should exist')
+hgt.asserttrue(os.path.exists('.hglf/foo.dat'), 'standin should exist')
+hgt.asserttrue(os.path.exists('.hglf/dir/big.dat'), 'standin should exist')
+hgt.asserttrue(os.path.exists('.hglf/dir/big'), 'standin should exist')
+hgt.asserttrue(os.path.exists('.hglf/dir/a/small.dat'), 'standin should exist')
+hgt.asserttrue(os.path.exists('.hglf/dir/z/bigbig.dat'), 'standin should exist')
+hgt.asserttrue(os.path.exists('.hglf/dir/z/bigbig'), 'standin should exist')
+hgt.assertfalse(os.path.exists('.hglf/foo'), "standin shouldn't exist")
+hgt.assertfalse(os.path.exists('.hglf/dir/a/small'), "standin shouldn't exist")
+os.chdir('..')
+common.checkrepos(hgt, 'repo1', 'repo3', [0, 1, 2, 3, 4])
+
+hgt.hg(['lfconvert', 'repo1', 'repo4', 'glob:**'],
+        stdout='initializing destination repo4\n')
+
+os.chdir('repo4')
+hgt.hg(['log'], stdout='''changeset:   4:9eb32e4bd7f8
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     remove some files
+
+changeset:   3:328686947dc0
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     move files
+
+changeset:   2:945475bab2b9
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     edit some files
+
+changeset:   1:3289dcfb5630
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add more files
+
+changeset:   0:6635c326e069
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     initial commit
+
+''')
+hgt.hg(['up'],
+        stdout='''8 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+8 largefiles updated, 0 removed
+''')
+hgt.asserttrue(os.path.exists('.hglf'), 'lfile standins should exist')
+hgt.asserttrue(os.path.exists('.hglf'), 'lfile standins should exist')
+hgt.asserttrue(os.path.exists('.hglf/foo.dat'), 'standin should exist')
+hgt.asserttrue(os.path.exists('.hglf/dir/big.dat'), 'standin should exist')
+hgt.asserttrue(os.path.exists('.hglf/dir/big'), 'standin should exist')
+hgt.asserttrue(os.path.exists('.hglf/dir/a/small.dat'), 'standin should exist')
+hgt.asserttrue(os.path.exists('.hglf/dir/z/bigbig.dat'), 'standin should exist')
+hgt.asserttrue(os.path.exists('.hglf/dir/z/bigbig'), 'standin should exist')
+hgt.asserttrue(os.path.exists('.hglf/foo'), 'standin should exist')
+hgt.asserttrue(os.path.exists('.hglf/dir/a/small'), 'standin should exist')
+os.chdir('..')
+common.checkrepos(hgt, 'repo1', 'repo4', [0, 1, 2, 3, 4])
+
+hgt.hg(['lfconvert', 'repo2', 'repo5', '--tonormal'], stdout='initializing destination repo5\n')
+common.checkrepos(hgt, 'repo1', 'repo5', [0, 1, 2, 3, 4])
+os.chdir('repo5')
+hgt.hg(['up'], stdout='0 files updated, 0 files merged, 0 files removed, 0 files unresolved\n')
+hgt.assertfalse(os.path.exists('.hglf'), 'there should not be any standins')
+os.chdir('..')
+
+hgt.hg(['lfconvert', 'repo3', 'repo6', '--tonormal'], stdout='initializing destination repo6\n')
+common.checkrepos(hgt, 'repo1', 'repo6', [0, 1, 2, 3, 4])
+os.chdir('repo6')
+hgt.hg(['up'], stdout='0 files updated, 0 files merged, 0 files removed, 0 files unresolved\n')
+hgt.assertfalse(os.path.exists('.hglf'), 'there should not be any standins')
+os.chdir('..')
+
+hgt.hg(['lfconvert', 'repo4', 'repo7', '--tonormal'], stdout='initializing destination repo7\n')
+common.checkrepos(hgt, 'repo4', 'repo7', [0, 1, 2, 3, 4])
+os.chdir('repo7')
+hgt.hg(['up'], stdout='0 files updated, 0 files merged, 0 files removed, 0 files unresolved\n')
+hgt.assertfalse(os.path.exists('.hglf'), 'there should not be any standins')
+os.chdir('..')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-convert.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-convert.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,27 @@
+% setup
+hg init
+hg add
+hg commit -m 'initial commit'
+hg add
+hg commit -m 'add more files'
+hg commit -m 'edit some files'
+hg mv z dir
+hg commit -m 'move files'
+hg rm dir/b
+hg commit -m 'remove some files'
+hg log
+hg lfconvert -s 100 repo1 repo2
+hg log
+hg up
+hg lfconvert repo1 repo3
+hg log
+hg up
+hg lfconvert repo1 repo4 'glob:**'
+hg log
+hg up
+hg lfconvert repo2 repo5 --tonormal
+hg up
+hg lfconvert repo3 repo6 --tonormal
+hg up
+hg lfconvert repo4 repo7 --tonormal
+hg up
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-converttags.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-converttags.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,329 @@
+#!/usr/bin/env python
+
+# Test that lfconvert handles tags properly
+
+import os
+import common
+
+hgt = common.LfilesTester()
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+os.mkdir('dir')
+os.mkdir('dir/a')
+os.mkdir('dir/b')
+os.mkdir('dir/b/c')
+os.mkdir('z')
+hgt.writefile('foo.dat', 'stuffnthings')
+hgt.writefile('foo', 'stuffnthings')
+hgt.writefile('dir/big.dat', 'a'*(1024*1024*3))
+hgt.writefile('dir/big', 'a'*(1024*1024*3))
+hgt.writefile('dir/a/small.dat', 'small')
+hgt.writefile('dir/a/small', 'small')
+hgt.hg(['add'],
+        stdout='''adding dir/a/small
+adding dir/a/small.dat
+adding dir/big
+adding dir/big.dat
+adding foo
+adding foo.dat
+''')
+hgt.hg(['commit', '-m', 'initial commit'])
+hgt.writefile('dir/b/medium.dat', 'b'*(1024*1024))
+hgt.writefile('dir/b/medium', 'b'*(1024*1024))
+hgt.writefile('dir/b/c/foo.dat', 'foo')
+hgt.writefile('dir/b/c/foo', 'foo')
+hgt.writefile('z/bigbig.dat', 'c'*(1024*1024*5))
+hgt.writefile('z/bigbig', 'c'*(1024*1024*5))
+hgt.hg(['add'],
+        stdout='''adding dir/b/c/foo
+adding dir/b/c/foo.dat
+adding dir/b/medium
+adding dir/b/medium.dat
+adding z/bigbig
+adding z/bigbig.dat
+''')
+hgt.hg(['commit', '-m', 'add more files'])
+hgt.hg(['tag', '-r', '0', 'first'])
+hgt.hg(['tag', '-r', '1', 'second'])
+hgt.hg(['tag', '-r', '3', 'last'])
+hgt.hg(['log', '-r', 'first'],
+        stdout='''changeset:   0:d82117283c29
+tag:         first
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     initial commit
+
+''')
+hgt.hg(['log', '-r', 'second'],
+        stdout='''changeset:   1:73960f5ccfe2
+tag:         second
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add more files
+
+''')
+hgt.hg(['log', '-r', 'last'],
+        stdout='''changeset:   3:e229b8d1bac1
+tag:         last
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag second for changeset 73960f5ccfe2
+
+''')
+hgt.hg(['log'],
+        stdout='''changeset:   4:c4495ce62a60
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag last for changeset e229b8d1bac1
+
+changeset:   3:e229b8d1bac1
+tag:         last
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag second for changeset 73960f5ccfe2
+
+changeset:   2:d41643b333a9
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag first for changeset d82117283c29
+
+changeset:   1:73960f5ccfe2
+tag:         second
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add more files
+
+changeset:   0:d82117283c29
+tag:         first
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     initial commit
+
+''')
+os.chdir('..')
+hgt.hg(['lfconvert', 'repo1', 'repo2', '-s', '1'], stdout='initializing destination repo2\n')
+os.chdir('repo2')
+hgt.hg(['log', '-r', 'first'], stdout='''changeset:   0:375267a9a304
+tag:         first
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     initial commit
+
+''')
+hgt.hg(['log', '-r', 'second'],
+        stdout='''changeset:   1:c844d4acbd96
+tag:         second
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add more files
+
+''')
+hgt.hg(['log', '-r', 'last'],
+        stdout='''changeset:   3:5cf84a2e6fa4
+tag:         last
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag second for changeset 73960f5ccfe2
+
+''')
+hgt.hg(['log'], stdout='''changeset:   4:da13683f4564
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag last for changeset e229b8d1bac1
+
+changeset:   3:5cf84a2e6fa4
+tag:         last
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag second for changeset 73960f5ccfe2
+
+changeset:   2:308ff2199df8
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag first for changeset d82117283c29
+
+changeset:   1:c844d4acbd96
+tag:         second
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add more files
+
+changeset:   0:375267a9a304
+tag:         first
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     initial commit
+
+''')
+hgt.hg(['up', '-r', '0'], stdout='''6 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+hgt.assertfalse(os.path.exists('.hgtags'), "hgtags doesn't match")
+hgt.hg(['up', '-r', '1'], stdout='''6 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+4 largefiles updated, 0 removed
+''')
+hgt.assertfalse(os.path.exists('.hgtags'), "hgtags doesn't match")
+hgt.hg(['up', '-r', '2'], stdout='''1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+0 largefiles updated, 0 removed
+''')
+hgt.asserttrue(hgt.readfile('.hgtags') == '375267a9a304fa24d1d164553fdb25b2af68a61d first\n', "hgtags doesn't match")
+hgt.hg(['up', '-r', '3'], stdout='''1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+0 largefiles updated, 0 removed
+''')
+hgt.asserttrue(hgt.readfile('.hgtags') == '375267a9a304fa24d1d164553fdb25b2af68a61d first\nc844d4acbd96c195fef5fc16f66860b75c4668f6 second\n', "hgtags doesn't match")
+hgt.hg(['up', '-r', '4'], stdout='''1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+0 largefiles updated, 0 removed
+''')
+hgt.asserttrue(hgt.readfile('.hgtags') == '375267a9a304fa24d1d164553fdb25b2af68a61d first\nc844d4acbd96c195fef5fc16f66860b75c4668f6 second\n5cf84a2e6fa4bc22b415a53eb773453e0fda7720 last\n', "hgtags doesn't match")
+
+os.chdir('..')
+hgt.hg(['lfconvert', 'repo2', 'repo3', '--tonormal'], stdout='initializing destination repo3\n')
+os.chdir('repo3')
+hgt.hg(['log', '-r', 'first'], stdout='''changeset:   0:d82117283c29
+tag:         first
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     initial commit
+
+''')
+hgt.hg(['log', '-r', 'second'],
+        stdout='''changeset:   1:73960f5ccfe2
+tag:         second
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add more files
+
+''')
+hgt.hg(['log', '-r', 'last'],
+        stdout='''changeset:   3:e229b8d1bac1
+tag:         last
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag second for changeset 73960f5ccfe2
+
+''')
+hgt.hg(['log'], stdout='''changeset:   4:c4495ce62a60
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag last for changeset e229b8d1bac1
+
+changeset:   3:e229b8d1bac1
+tag:         last
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag second for changeset 73960f5ccfe2
+
+changeset:   2:d41643b333a9
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag first for changeset d82117283c29
+
+changeset:   1:73960f5ccfe2
+tag:         second
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add more files
+
+changeset:   0:d82117283c29
+tag:         first
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     initial commit
+
+''')
+hgt.hg(['up', '-r', '0'], stdout='6 files updated, 0 files merged, 0 files removed, 0 files unresolved\n')
+hgt.assertfalse(os.path.exists('.hgtags'), "hgtags doesn't match")
+hgt.hg(['up', '-r', '1'], stdout='6 files updated, 0 files merged, 0 files removed, 0 files unresolved\n')
+hgt.assertfalse(os.path.exists('.hgtags'), "hgtags doesn't match")
+hgt.hg(['up', '-r', '2'], stdout='1 files updated, 0 files merged, 0 files removed, 0 files unresolved\n')
+hgt.asserttrue(hgt.readfile('.hgtags') == 'd82117283c29e97adb8ebbcc5ea8fb7613ad0864 first\n', "hgtags doesn't match")
+hgt.hg(['up', '-r', '3'], stdout='1 files updated, 0 files merged, 0 files removed, 0 files unresolved\n')
+hgt.asserttrue(hgt.readfile('.hgtags') == 'd82117283c29e97adb8ebbcc5ea8fb7613ad0864 first\n73960f5ccfe2ca2f74002e55d74f186678f53872 second\n', "hgtags doesn't match")
+hgt.hg(['up', '-r', '4'], stdout='1 files updated, 0 files merged, 0 files removed, 0 files unresolved\n')
+hgt.asserttrue(hgt.readfile('.hgtags') == 'd82117283c29e97adb8ebbcc5ea8fb7613ad0864 first\n73960f5ccfe2ca2f74002e55d74f186678f53872 second\ne229b8d1bac18cbd3eef20f9433c076fe45fa97d last\n', "hgtags doesn't match")
+os.chdir('..')
+hgt.hg(['tag', '-R', 'repo3', 'fromroot'])
+hgt.hg(['log', '-R', 'repo3'], stdout='''changeset:   5:d9771069dce1
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag fromroot for changeset c4495ce62a60
+
+changeset:   4:c4495ce62a60
+tag:         fromroot
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag last for changeset e229b8d1bac1
+
+changeset:   3:e229b8d1bac1
+tag:         last
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag second for changeset 73960f5ccfe2
+
+changeset:   2:d41643b333a9
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag first for changeset d82117283c29
+
+changeset:   1:73960f5ccfe2
+tag:         second
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add more files
+
+changeset:   0:d82117283c29
+tag:         first
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     initial commit
+
+''')
+hgt.hg(['tag', '-R', 'repo2', 'fromroot'])
+hgt.hg(['log', '-R', 'repo2'], stdout='''changeset:   5:3b2fad27fb92
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag fromroot for changeset da13683f4564
+
+changeset:   4:da13683f4564
+tag:         fromroot
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag last for changeset e229b8d1bac1
+
+changeset:   3:5cf84a2e6fa4
+tag:         last
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag second for changeset 73960f5ccfe2
+
+changeset:   2:308ff2199df8
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     Added tag first for changeset d82117283c29
+
+changeset:   1:c844d4acbd96
+tag:         second
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add more files
+
+changeset:   0:375267a9a304
+tag:         first
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     initial commit
+
+''')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-converttags.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-converttags.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,37 @@
+% setup
+hg init
+hg add
+hg commit -m 'initial commit'
+hg add
+hg commit -m 'add more files'
+hg tag -r 0 first
+hg tag -r 1 second
+hg tag -r 3 last
+hg log -r first
+hg log -r second
+hg log -r last
+hg log
+hg lfconvert repo1 repo2 -s 1
+hg log -r first
+hg log -r second
+hg log -r last
+hg log
+hg up -r 0
+hg up -r 1
+hg up -r 2
+hg up -r 3
+hg up -r 4
+hg lfconvert repo2 repo3 --tonormal
+hg log -r first
+hg log -r second
+hg log -r last
+hg log
+hg up -r 0
+hg up -r 1
+hg up -r 2
+hg up -r 3
+hg up -r 4
+hg tag -R repo3 fromroot
+hg log -R repo3
+hg tag -R repo2 fromroot
+hg log -R repo2
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-copyrename.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-copyrename.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,456 @@
+#!/usr/bin/env python
+
+# Test copy and rename
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+def checkfile(file, contents):
+    hgt.asserttrue(hgt.readfile(file) == contents, 'file contents dont match')
+
+# add size and patterns for adding as a largefiles
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init', '-q'])
+hgt.writefile('normal1', 'n1')
+hgt.writefile('normal2', 'n2')
+hgt.writefile('normal3.txt', 'n3')
+hgt.writefile('normal4.txt', 'n4')
+hgt.hg(['add', 'normal1', 'normal2', 'normal3.txt', 'normal4.txt'])
+hgt.writefile('big1', 'b1')
+hgt.writefile('big2', 'b2')
+hgt.writefile('big3.txt', 'b3')
+hgt.writefile('big4.txt', 'b4')
+hgt.hg(['add', '--large', 'big1', 'big2', 'big3.txt', 'big4.txt'])
+hgt.hg(['commit', '-m', 'added files'])
+
+hgt.announce('copy all to directory')
+os.mkdir('dir')
+hgt.hg(['copy', 'glob:*', 'dir'],
+        stdout=('copying normal1 to dir/normal1\n'
+                'copying normal2 to dir/normal2\n'
+                'copying normal3.txt to dir/normal3.txt\n'
+                'copying normal4.txt to dir/normal4.txt\n'
+                'copying .hglf/big1 to .hglf/dir/big1\n'
+                'copying .hglf/big2 to .hglf/dir/big2\n'
+                'copying .hglf/big3.txt to .hglf/dir/big3.txt\n'
+                'copying .hglf/big4.txt to .hglf/dir/big4.txt\n'))
+checkfile('dir/normal1', 'n1')
+checkfile('dir/normal2', 'n2')
+checkfile('dir/normal3.txt', 'n3')
+checkfile('dir/normal4.txt', 'n4')
+checkfile('dir/big1', 'b1')
+checkfile('dir/big2', 'b2')
+checkfile('dir/big3.txt', 'b3')
+checkfile('dir/big4.txt', 'b4')
+hgt.hg(['status'],
+        stdout=('A dir/big1\n'
+                'A dir/big2\n'
+                'A dir/big3.txt\n'
+                'A dir/big4.txt\n'
+                'A dir/normal1\n'
+                'A dir/normal2\n'
+                'A dir/normal3.txt\n'
+                'A dir/normal4.txt\n'))
+hgt.hg(['commit', '-m', 'added copies'])
+hgt.hg(['status'])
+
+hgt.announce('copy some to directory')
+os.mkdir('dir2')
+hgt.hg(['copy', 'glob:*.txt', 'dir2'],
+        stdout=('copying normal3.txt to dir2/normal3.txt\n'
+                'copying normal4.txt to dir2/normal4.txt\n'
+                'copying .hglf/big3.txt to .hglf/dir2/big3.txt\n'
+                'copying .hglf/big4.txt to .hglf/dir2/big4.txt\n'))
+checkfile('dir2/normal3.txt', 'n3')
+checkfile('dir2/normal4.txt', 'n4')
+checkfile('dir2/big3.txt', 'b3')
+checkfile('dir2/big4.txt', 'b4')
+hgt.assertfalse(os.path.exists('dir2/normal1'), 'file should not exist')
+hgt.assertfalse(os.path.exists('dir2/normal2'), 'file should not exist')
+hgt.assertfalse(os.path.exists('dir2/big1'), 'file should not exist')
+hgt.assertfalse(os.path.exists('dir2/big2'), 'file should not exist')
+hgt.hg(['status'],
+        stdout=('A dir2/big3.txt\n'
+                'A dir2/big4.txt\n'
+                'A dir2/normal3.txt\n'
+                'A dir2/normal4.txt\n'))
+hgt.hg(['commit', '-m', 'added some'])
+hgt.hg(['status'])
+
+hgt.announce('rewrite root files and copy all to dir2')
+hgt.writefile('normal1', 'n11')
+hgt.writefile('normal2', 'n22')
+hgt.writefile('normal3.txt', 'n33')
+hgt.writefile('normal4.txt', 'n44')
+hgt.writefile('big1', 'b11')
+hgt.writefile('big2', 'b22')
+hgt.writefile('big3.txt', 'b33')
+hgt.writefile('big4.txt', 'b44')
+hgt.hg(['commit', '-m', 'edit'])
+hgt.hg(['copy', 'glob:*', 'dir2'],
+        stdout=('copying normal1 to dir2/normal1\n'
+                'copying normal2 to dir2/normal2\n'
+                'copying .hglf/big1 to .hglf/dir2/big1\n'
+                'copying .hglf/big2 to .hglf/dir2/big2\n'),
+        stderr=('dir2/normal3.txt: not overwriting - file exists\n'
+                'dir2/normal4.txt: not overwriting - file exists\n'
+                '.hglf/dir2/big3.txt: not overwriting - file exists\n'
+                '.hglf/dir2/big4.txt: not overwriting - file exists\n'))
+hgt.hg(['status'],
+        stdout=('A dir2/big1\n'
+                'A dir2/big2\n'
+                'A dir2/normal1\n'
+                'A dir2/normal2\n'))
+hgt.hg(['commit', '-m', 'copy again'])
+hgt.hg(['status'])
+checkfile('dir2/normal1', 'n11')
+checkfile('dir2/normal2', 'n22')
+checkfile('dir2/normal3.txt', 'n3')
+checkfile('dir2/normal4.txt', 'n4')
+checkfile('dir2/big1', 'b11')
+checkfile('dir2/big2', 'b22')
+checkfile('dir2/big3.txt', 'b3')
+checkfile('dir2/big4.txt', 'b4')
+checkfile('normal1', 'n11')
+checkfile('normal2', 'n22')
+checkfile('normal3.txt', 'n33')
+checkfile('normal4.txt', 'n44')
+checkfile('big1', 'b11')
+checkfile('big2', 'b22')
+checkfile('big3.txt', 'b33')
+checkfile('big4.txt', 'b44')
+
+hgt.announce('copy files by name to dir3')
+os.mkdir('dir3')
+hgt.hg(['copy', 'normal1', 'normal3.txt', 'big1', 'big3.txt', 'dir3'])
+hgt.hg(['status'],
+         stdout=('A dir3/big1\n'
+                 'A dir3/big3.txt\n'
+                 'A dir3/normal1\n'
+                 'A dir3/normal3.txt\n'))
+hgt.hg(['commit', '-m', 'copy individual'])
+hgt.hg(['status'])
+checkfile('dir3/normal1', 'n11')
+checkfile('dir3/normal3.txt', 'n33')
+checkfile('dir3/big1', 'b11')
+checkfile('dir3/big3.txt', 'b33')
+hgt.assertfalse(os.path.exists('dir3/normal2'), 'file should not exist')
+hgt.assertfalse(os.path.exists('dir3/normal4.txt'), 'file should not exist')
+hgt.assertfalse(os.path.exists('dir3/big2'), 'file should not exist')
+hgt.assertfalse(os.path.exists('dir3/big4.txt'), 'file should not exist')
+
+hgt.announce('rename some files to dir4')
+os.mkdir('dir4')
+hgt.hg(['rename', 'glob:*.txt', 'dir4'],
+        stdout=('moving normal3.txt to dir4/normal3.txt\n'
+               'moving normal4.txt to dir4/normal4.txt\n'
+               'moving .hglf/big3.txt to .hglf/dir4/big3.txt\n'
+               'moving .hglf/big4.txt to .hglf/dir4/big4.txt\n'))
+hgt.hg(['status'],
+        stdout=('A dir4/big3.txt\n'
+                'A dir4/big4.txt\n'
+                'A dir4/normal3.txt\n'
+                'A dir4/normal4.txt\n'
+                'R big3.txt\n'
+                'R big4.txt\n'
+                'R normal3.txt\n'
+                'R normal4.txt\n'))
+checkfile('dir4/normal3.txt', 'n33')
+checkfile('dir4/normal4.txt', 'n44')
+checkfile('dir4/big3.txt', 'b33')
+checkfile('dir4/big4.txt', 'b44')
+hgt.assertfalse(os.path.exists('dir4/normal1'), 'file should not exist')
+hgt.assertfalse(os.path.exists('dir4/normal2'), 'file should not exist')
+hgt.assertfalse(os.path.exists('dir4/big1'), 'file should not exist')
+hgt.assertfalse(os.path.exists('dir4/big2'), 'file should not exist')
+hgt.assertfalse(os.path.exists('normal3.txt'), 'file should not exist')
+hgt.assertfalse(os.path.exists('normal4.txt'), 'file should not exist')
+hgt.assertfalse(os.path.exists('big3.txt'), 'file should not exist')
+hgt.assertfalse(os.path.exists('big4.txt'), 'file should not exist')
+
+
+hgt.announce('rename remaining files to dir5')
+os.mkdir('dir5')
+hgt.hg(['rename', 'glob:*', 'dir5'],
+        stdout=('moving normal1 to dir5/normal1\n'
+               'moving normal2 to dir5/normal2\n'
+               'moving .hglf/big1 to .hglf/dir5/big1\n'
+               'moving .hglf/big2 to .hglf/dir5/big2\n'))
+hgt.hg(['status'],
+         stdout=('A dir4/big3.txt\n'
+                 'A dir4/big4.txt\n'
+                 'A dir4/normal3.txt\n'
+                 'A dir4/normal4.txt\n'
+                 'A dir5/big1\n'
+                 'A dir5/big2\n'
+                 'A dir5/normal1\n'
+                 'A dir5/normal2\n'
+                 'R big1\n'
+                 'R big2\n'
+                 'R big3.txt\n'
+                 'R big4.txt\n'
+                 'R normal1\n'
+                 'R normal2\n'
+                 'R normal3.txt\n'
+                 'R normal4.txt\n'))
+hgt.hg(['commit', '-m', 'rename to dir5'])
+hgt.hg(['status'])
+checkfile('dir5/normal1', 'n11')
+checkfile('dir5/normal2', 'n22')
+checkfile('dir5/big1', 'b11')
+checkfile('dir5/big2', 'b22')
+hgt.assertfalse(os.path.exists('dir5/normal3.txt'), 'file should not exist')
+hgt.assertfalse(os.path.exists('dir5/normal4.txt'), 'file should not exist')
+hgt.assertfalse(os.path.exists('dir5/big3.txt'), 'file should not exist')
+hgt.assertfalse(os.path.exists('dir5/big4.txt'), 'file should not exist')
+hgt.assertfalse(os.path.exists('normal1'), 'file should not exist')
+hgt.assertfalse(os.path.exists('normal2'), 'file should not exist')
+hgt.assertfalse(os.path.exists('big1'), 'file should not exist')
+hgt.assertfalse(os.path.exists('big2'), 'file should not exist')
+
+hgt.announce('big copy')
+os.mkdir('bdir1')
+hgt.hg(['copy', 'dir', 'dir2', 'bdir1'],
+        stdout=('copying dir/normal1 to bdir1/dir/normal1\n'
+                'copying dir/normal2 to bdir1/dir/normal2\n'
+                'copying dir/normal3.txt to bdir1/dir/normal3.txt\n'
+                'copying dir/normal4.txt to bdir1/dir/normal4.txt\n'
+                'copying dir2/normal1 to bdir1/dir2/normal1\n'
+                'copying dir2/normal2 to bdir1/dir2/normal2\n'
+                'copying dir2/normal3.txt to bdir1/dir2/normal3.txt\n'
+                'copying dir2/normal4.txt to bdir1/dir2/normal4.txt\n'
+                'copying .hglf/dir/big1 to .hglf/bdir1/dir/big1\n'
+                'copying .hglf/dir/big2 to .hglf/bdir1/dir/big2\n'
+                'copying .hglf/dir/big3.txt to .hglf/bdir1/dir/big3.txt\n'
+                'copying .hglf/dir/big4.txt to .hglf/bdir1/dir/big4.txt\n'
+                'copying .hglf/dir2/big1 to .hglf/bdir1/dir2/big1\n'
+                'copying .hglf/dir2/big2 to .hglf/bdir1/dir2/big2\n'
+                'copying .hglf/dir2/big3.txt to .hglf/bdir1/dir2/big3.txt\n'
+                'copying .hglf/dir2/big4.txt to .hglf/bdir1/dir2/big4.txt\n'))
+hgt.hg(['status'],
+    stdout=('A bdir1/dir/big1\n'
+            'A bdir1/dir/big2\n'
+            'A bdir1/dir/big3.txt\n'
+            'A bdir1/dir/big4.txt\n'
+            'A bdir1/dir/normal1\n'
+            'A bdir1/dir/normal2\n'
+            'A bdir1/dir/normal3.txt\n'
+            'A bdir1/dir/normal4.txt\n'
+            'A bdir1/dir2/big1\n'
+            'A bdir1/dir2/big2\n'
+            'A bdir1/dir2/big3.txt\n'
+            'A bdir1/dir2/big4.txt\n'
+            'A bdir1/dir2/normal1\n'
+            'A bdir1/dir2/normal2\n'
+            'A bdir1/dir2/normal3.txt\n'
+            'A bdir1/dir2/normal4.txt\n'))
+hgt.hg(['commit', '-m', 'big copy1'])
+hgt.hg(['status'])
+
+hgt.announce('big rename')
+os.mkdir('bdir2')
+os.mkdir('bdir2/dir')
+os.chdir('bdir2')
+hgt.hg(['copy', '../dir3', '../dir4', '../dir5', 'dir'],
+    stdout=('copying ../dir3/normal1 to dir/dir3/normal1\n'
+            'copying ../dir3/normal3.txt to dir/dir3/normal3.txt\n'
+            'copying ../dir4/normal3.txt to dir/dir4/normal3.txt\n'
+            'copying ../dir4/normal4.txt to dir/dir4/normal4.txt\n'
+            'copying ../dir5/normal1 to dir/dir5/normal1\n'
+            'copying ../dir5/normal2 to dir/dir5/normal2\n'
+            'copying ../.hglf/dir3/big1 to ../.hglf/bdir2/dir/dir3/big1\n'
+            'copying ../.hglf/dir3/big3.txt to ../.hglf/bdir2/dir/dir3/big3.txt\n'
+            'copying ../.hglf/dir4/big3.txt to ../.hglf/bdir2/dir/dir4/big3.txt\n'
+            'copying ../.hglf/dir4/big4.txt to ../.hglf/bdir2/dir/dir4/big4.txt\n'
+            'copying ../.hglf/dir5/big1 to ../.hglf/bdir2/dir/dir5/big1\n'
+            'copying ../.hglf/dir5/big2 to ../.hglf/bdir2/dir/dir5/big2\n'))
+hgt.hg(['status'],
+    stdout=('A bdir2/dir/dir3/big1\n'
+            'A bdir2/dir/dir3/big3.txt\n'
+            'A bdir2/dir/dir3/normal1\n'
+            'A bdir2/dir/dir3/normal3.txt\n'
+            'A bdir2/dir/dir4/big3.txt\n'
+            'A bdir2/dir/dir4/big4.txt\n'
+            'A bdir2/dir/dir4/normal3.txt\n'
+            'A bdir2/dir/dir4/normal4.txt\n'
+            'A bdir2/dir/dir5/big1\n'
+            'A bdir2/dir/dir5/big2\n'
+            'A bdir2/dir/dir5/normal1\n'
+            'A bdir2/dir/dir5/normal2\n'))
+hgt.hg(['commit', '-m', 'big copy2'])
+hgt.hg(['status', '-A'],
+            stdout='''C bdir1/dir/big1
+C bdir1/dir/big2
+C bdir1/dir/big3.txt
+C bdir1/dir/big4.txt
+C bdir1/dir/normal1
+C bdir1/dir/normal2
+C bdir1/dir/normal3.txt
+C bdir1/dir/normal4.txt
+C bdir1/dir2/big1
+C bdir1/dir2/big2
+C bdir1/dir2/big3.txt
+C bdir1/dir2/big4.txt
+C bdir1/dir2/normal1
+C bdir1/dir2/normal2
+C bdir1/dir2/normal3.txt
+C bdir1/dir2/normal4.txt
+C bdir2/dir/dir3/big1
+C bdir2/dir/dir3/big3.txt
+C bdir2/dir/dir3/normal1
+C bdir2/dir/dir3/normal3.txt
+C bdir2/dir/dir4/big3.txt
+C bdir2/dir/dir4/big4.txt
+C bdir2/dir/dir4/normal3.txt
+C bdir2/dir/dir4/normal4.txt
+C bdir2/dir/dir5/big1
+C bdir2/dir/dir5/big2
+C bdir2/dir/dir5/normal1
+C bdir2/dir/dir5/normal2
+C dir/big1
+C dir/big2
+C dir/big3.txt
+C dir/big4.txt
+C dir/normal1
+C dir/normal2
+C dir/normal3.txt
+C dir/normal4.txt
+C dir2/big1
+C dir2/big2
+C dir2/big3.txt
+C dir2/big4.txt
+C dir2/normal1
+C dir2/normal2
+C dir2/normal3.txt
+C dir2/normal4.txt
+C dir3/big1
+C dir3/big3.txt
+C dir3/normal1
+C dir3/normal3.txt
+C dir4/big3.txt
+C dir4/big4.txt
+C dir4/normal3.txt
+C dir4/normal4.txt
+C dir5/big1
+C dir5/big2
+C dir5/normal1
+C dir5/normal2
+''')
+
+hgt.announce('single copy')
+hgt.writefile('foo', 'stuff')
+hgt.hg(['add', 'foo'])
+hgt.hg(['commit', '-m', 'added foo'])
+hgt.hg(['cp', 'foo', 'bar'])
+
+hgt.announce('single copy2')
+hgt.writefile('foo2', 'stuff')
+hgt.hg(['add', '--large', 'foo2'])
+hgt.hg(['commit', '-m', 'added foo2'])
+hgt.hg(['cp', 'foo2', 'bar2'])
+
+hgt.announce('relative rename')
+os.chdir('..')
+os.mkdir('repo2')
+os.chdir('repo2')
+hgt.hg(['init'])
+os.mkdir('a')
+os.mkdir('dest')
+os.chdir('a')
+os.mkdir('b')
+os.mkdir('c')
+os.mkdir('b/b')
+hgt.writefile('n1', 'n1')
+hgt.writefile('b/n2', 'n2')
+hgt.writefile('c/n3', 'n3')
+hgt.writefile('b/b/n4', 'n4')
+hgt.hg(['add'],
+        stdout='''adding b/b/n4
+adding b/n2
+adding c/n3
+adding n1
+''')
+hgt.writefile('b1', 'b1')
+hgt.writefile('b/b2', 'b2')
+hgt.writefile('c/b3', 'b3')
+hgt.writefile('b/b/b4', 'b4')
+hgt.hg(['add', '--large'],
+        stdout='''adding b/b/b4 as a largefile
+adding b/b2 as a largefile
+adding b1 as a largefile
+adding c/b3 as a largefile
+''')
+hgt.hg(['commit', '-m', 'add files'])
+hgt.hg(['rename', '.', '../dest'],
+        stdout='''moving b/b/n4 to ../dest/a/b/b/n4
+moving b/n2 to ../dest/a/b/n2
+moving c/n3 to ../dest/a/c/n3
+moving n1 to ../dest/a/n1
+moving ../.hglf/a/b/b/b4 to ../.hglf/dest/a/b/b/b4
+moving ../.hglf/a/b/b2 to ../.hglf/dest/a/b/b2
+moving ../.hglf/a/b1 to ../.hglf/dest/a/b1
+moving ../.hglf/a/c/b3 to ../.hglf/dest/a/c/b3
+''')
+hgt.hg(['status'],
+        stdout='''A dest/a/b/b/b4
+A dest/a/b/b/n4
+A dest/a/b/b2
+A dest/a/b/n2
+A dest/a/b1
+A dest/a/c/b3
+A dest/a/c/n3
+A dest/a/n1
+R a/b/b/b4
+R a/b/b/n4
+R a/b/b2
+R a/b/n2
+R a/b1
+R a/c/b3
+R a/c/n3
+R a/n1
+''')
+
+hgt.announce('relative rename without lfiles')
+os.chdir('..')
+os.mkdir('repo2')
+os.chdir('repo2')
+hgt.hg(['init'])
+os.mkdir('a')
+os.mkdir('dest')
+os.chdir('a')
+os.mkdir('b')
+os.mkdir('c')
+os.mkdir('b/b')
+hgt.writefile('n1', 'n1')
+hgt.writefile('b/n2', 'n2')
+hgt.writefile('c/n3', 'n3')
+hgt.writefile('b/b/n4', 'n4')
+hgt.hg(['add'],
+        stdout='''adding b/b/n4
+adding b/n2
+adding c/n3
+adding n1
+''')
+hgt.hg(['commit', '-m', 'add files'])
+hgt.hg(['rename', '.', '../dest'],
+        stdout='''moving b/b/n4 to ../dest/a/b/b/n4
+moving b/n2 to ../dest/a/b/n2
+moving c/n3 to ../dest/a/c/n3
+moving n1 to ../dest/a/n1
+''')
+os.chdir('..')
+hgt.hg(['status'],
+        stdout='''A dest/a/b/b/n4
+A dest/a/b/n2
+A dest/a/c/n3
+A dest/a/n1
+R a/b/b/n4
+R a/b/n2
+R a/c/n3
+R a/n1
+''')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-copyrename.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-copyrename.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,77 @@
+% setup
+hg init -q
+hg add normal1 normal2 normal3.txt normal4.txt
+hg add --large big1 big2 big3.txt big4.txt
+hg commit -m 'added files'
+
+% copy all to directory
+hg copy 'glob:*' dir
+hg status
+hg commit -m 'added copies'
+hg status
+
+% copy some to directory
+hg copy 'glob:*.txt' dir2
+hg status
+hg commit -m 'added some'
+hg status
+
+% rewrite root files and copy all to dir2
+hg commit -m edit
+hg copy 'glob:*' dir2
+hg status
+hg commit -m 'copy again'
+hg status
+
+% copy files by name to dir3
+hg copy normal1 normal3.txt big1 big3.txt dir3
+hg status
+hg commit -m 'copy individual'
+hg status
+
+% rename some files to dir4
+hg rename 'glob:*.txt' dir4
+hg status
+
+% rename remaining files to dir5
+hg rename 'glob:*' dir5
+hg status
+hg commit -m 'rename to dir5'
+hg status
+
+% big copy
+hg copy dir dir2 bdir1
+hg status
+hg commit -m 'big copy1'
+hg status
+
+% big rename
+hg copy ../dir3 ../dir4 ../dir5 dir
+hg status
+hg commit -m 'big copy2'
+hg status -A
+
+% single copy
+hg add foo
+hg commit -m 'added foo'
+hg cp foo bar
+
+% single copy2
+hg add --large foo2
+hg commit -m 'added foo2'
+hg cp foo2 bar2
+
+% relative rename
+hg init
+hg add
+hg add --large
+hg commit -m 'add files'
+hg rename . ../dest
+hg status
+
+% relative rename without lfiles
+hg init
+hg add
+hg commit -m 'add files'
+hg rename . ../dest
+hg status
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-edit.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-edit.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+
+# Test that edited lfiles show up as modified
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+def rejoin(path):
+    '''convert unix path to local convention'''
+    return os.path.join(*path.split('/'))
+
+# add size and patterns for adding as a largefiles
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init', '-q'])
+hgt.writefile('normal1', 'foo')
+os.mkdir('sub')
+hgt.writefile('sub/normal2', 'bar')
+hgt.hg(['add', '-q', 'normal1', rejoin('sub/normal2')])
+hgt.hg(['commit', '-m', 'add normal files'])
+
+hgt.announce('add lfiles')
+hgt.writefile('big1', 'abc')
+hgt.writefile('sub/big2', 'xyz')
+hgt.hg(['add', '--large', 'big1', rejoin('sub/big2')])
+hgt.hg(['status'], stdout='A big1\nA sub/big2\n')
+hgt.hg(['commit', '-m', 'added lfiles'])
+
+hgt.announce('edit big1')
+hgt.writefile('big1', 'abcd')
+hgt.hg(['status'], stdout='M big1\n')
+
+hgt.announce('edit sub/big2')
+hgt.writefile('sub/big2', 'xyz1')
+hgt.hg(['status'], stdout='M big1\nM sub/big2\n')
+
+hgt.announce('edit big1 back')
+hgt.writefile('big1', 'abc')
+hgt.hg(['status'], stdout='M sub/big2\n')
+
+hgt.announce('edit sub/big2 back')
+hgt.writefile('sub/big2', 'xyz')
+hgt.hg(['status'])
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-edit.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-edit.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,21 @@
+% setup
+hg init -q
+hg add -q normal1 sub/normal2
+hg commit -m 'add normal files'
+
+% add lfiles
+hg add --large big1 sub/big2
+hg status
+hg commit -m 'added lfiles'
+
+% edit big1
+hg status
+
+% edit sub/big2
+hg status
+
+% edit big1 back
+hg status
+
+% edit sub/big2 back
+hg status
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-fetch.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-fetch.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+#
+# Test the fetch extension. Always give it a specific message because the message
+# it automatically adds includes the path which is randomly generated.
+import os
+import common
+
+hgt = common.LfilesTester()
+
+# add size and patterns for adding as largefiles
+hgt.updaterc({'extensions':[('fetch','')]})
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+hgt.writefile('n1', 'n1')
+hgt.writefile('b1', 'b1')
+os.mkdir('dir')
+hgt.writefile('dir/n2', 'n2')
+hgt.writefile('dir/b2', 'b2')
+hgt.hg(['add', 'n1', 'dir/n2'])
+hgt.hg(['add', '--large'],
+        stdout='''adding b1 as a largefile
+adding dir/b2 as a largefile
+''')
+hgt.hg(['commit', '-m', 'add files'])
+os.chdir('..')
+hgt.hg(['clone', 'repo1', 'repo2'],
+        stdout='''updating to branch default
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+os.chdir('repo1')
+hgt.writefile('n1', 'n11')
+hgt.writefile('b1', 'b11')
+hgt.hg(['commit', '-m', 'edit files'])
+os.chdir('..')
+
+hgt.announce('fetch')
+os.chdir('repo2')
+hgt.hg(['fetch', '../repo1', '-d', '1 0', '-m', 'automated merge'],
+        stdout='''pulling from ../repo1
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 2 changes to 2 files
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+1 largefiles updated, 0 removed
+''')
+hgt.hg(['mv', 'dir/n2', 'n2'])
+hgt.hg(['mv', 'dir/b2', 'b2'])
+hgt.hg(['commit', '-m', 'move files'])
+os.chdir('../repo1')
+hgt.writefile('dir/n2', 'n22')
+hgt.writefile('dir/b2', 'b22')
+hgt.hg(['commit', '-m', 'edit files'])
+hgt.hg(['fetch', '../repo2', '-d', '2 0', '-m', 'automated merge'],
+        stdout='''pulling from ../repo2
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 2 changes to 2 files (+1 heads)
+updating to 3:46a1bf42008d
+2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+getting changed largefiles
+1 largefiles updated, 1 removed
+merging with 2:bb292cc33358
+merging b2 and dir/b2 to b2
+merging n2 and dir/n2 to n2
+0 files updated, 2 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+1 largefiles updated, 0 removed
+new changeset 4:f2480f3cc82b merges remote changes with local
+''')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-fetch.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-fetch.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,15 @@
+% setup
+hg init
+hg add n1 dir/n2
+hg add --large
+hg commit -m 'add files'
+hg clone repo1 repo2
+hg commit -m 'edit files'
+
+% fetch
+hg fetch ../repo1 -d '1 0' -m 'automated merge'
+hg mv dir/n2 n2
+hg mv dir/b2 b2
+hg commit -m 'move files'
+hg commit -m 'edit files'
+hg fetch ../repo2 -d '2 0' -m 'automated merge'
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-forget.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-forget.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,186 @@
+#!/usr/bin/env python
+
+# Test remove
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+def rejoin(path):
+    '''convert unix path to local convention'''
+    return os.path.join(*path.split('/'))
+
+# add size and patterns for adding as a largefiles
+hgt.updaterc({'largefiles': [('size', '2'), ('patterns', 'glob:**.dat')]})
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init', '-q'])
+hgt.writefile('normal1', 'foo')
+os.mkdir('sub')
+hgt.writefile('sub/normal2', 'bar')
+hgt.writefile('sub/normal3.txt', 'bar2')
+hgt.writefile('sub/normal4.txt', 'bar3')
+hgt.hg(['add', '-q', 'normal1', rejoin('sub/normal2'), rejoin('sub/normal3.txt'), rejoin('sub/normal4.txt')])
+hgt.hg(['commit', '-m', 'add normal files'])
+
+hgt.announce('add lfiles')
+hgt.writefile('big1', 'abc')
+hgt.writefile('sub/big2', 'xyz')
+hgt.writefile('sub/big3.txt', 'xyz')
+hgt.hg(['add', '-q', '--large', 'big1', rejoin('sub/big2'), rejoin('sub/big3.txt')])
+hgt.hg(['commit', '-m', 'added lfiles'])
+
+hgt.announce('forget sub/*.txt')
+hgt.hg(['forget', 'glob:sub/*.txt'],
+        stdout=('removing sub/normal3.txt\n'
+                'removing sub/normal4.txt\n'
+                'removing sub/big3.txt\n'))
+hgt.asserttrue(os.path.exists('sub/normal3.txt'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal4.txt'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big3.txt'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist')
+hgt.hg(['status'],
+        stdout=('R sub/big3.txt\n'
+                'R sub/normal3.txt\n'
+                'R sub/normal4.txt\n'))
+hgt.hg(['commit', '-m', 'forget lfiles'])
+os.unlink('sub/normal3.txt')
+os.unlink('sub/normal4.txt')
+os.unlink('sub/big3.txt')
+
+hgt.announce('test update')
+hgt.hg(['up', '-r', '1'],
+        stdout=('3 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '1 largefiles updated, 0 removed\n'))
+hgt.asserttrue(os.path.exists('sub/normal3.txt'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal4.txt'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big3.txt'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist')
+hgt.hg(['up'],
+        stdout=('0 files updated, 0 files merged, 3 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '0 largefiles updated, 1 removed\n'))
+hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists')
+hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist')
+
+hgt.announce('forget single normal files')
+hgt.hg(['forget', 'normal1'])
+hgt.hg(['forget', 'sub/normal2'])
+hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists')
+hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist')
+hgt.hg(['status'],
+        stdout=('R normal1\n'
+                'R sub/normal2\n'))
+
+hgt.announce('forget single lfiles')
+hgt.hg(['forget', 'big1'])
+hgt.hg(['forget', 'sub/big2'])
+hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists')
+hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist')
+hgt.hg(['status'],
+        stdout=('R big1\n'
+                'R normal1\n'
+                'R sub/big2\n'
+                'R sub/normal2\n'))
+hgt.hg(['commit', '-m', 'all gone'])
+hgt.hg(['status'],
+        stdout='''? big1
+? normal1
+? sub/big2
+? sub/normal2
+''')
+
+hgt.announce('setup')
+os.chdir('..')
+os.mkdir('repo2')
+os.chdir('repo2')
+hgt.hg(['init'])
+os.mkdir('bar')
+os.chdir('bar')
+os.mkdir('bar')
+os.chdir('bar')
+os.mkdir('foo')
+os.chdir('foo')
+hgt.writefile('n1', 'n1')
+hgt.writefile('n2.txt', 'n2')
+hgt.writefile('../n3.foo', 'n3')
+hgt.writefile('b1', 'b1')
+hgt.writefile('b2.txt', 'b2')
+hgt.writefile('../b3.foo', 'b3')
+hgt.hg(['add', 'n1', 'n2.txt', '../n3.foo'])
+hgt.hg(['add', '--large', 'b1', 'b2.txt', '../b3.foo'])
+hgt.hg(['status'],
+        stdout='''A bar/bar/b3.foo
+A bar/bar/foo/b1
+A bar/bar/foo/b2.txt
+A bar/bar/foo/n1
+A bar/bar/foo/n2.txt
+A bar/bar/n3.foo
+''')
+hgt.hg(['commit', '-m', 'add files'])
+
+hgt.announce('test forget and add')
+hgt.hg(['forget', 'glob:../*.foo'],
+        stdout='''removing ../n3.foo
+removing ../b3.foo
+''')
+hgt.hg(['status'],
+        stdout='''R bar/bar/b3.foo
+R bar/bar/n3.foo
+''')
+hgt.hg(['add', '../n3.foo'])
+hgt.hg(['add', '--large', '../b3.foo'])
+hgt.hg(['status'])
+# Mercurial < 1.6 doesn't return non zero status, but >= 1.6 does so allow both
+hgt.hg(['commit', '-m', 'did i change things?'], stdout='nothing changed\n', status = [0,1])
+hgt.hg(['forget', '../n3.foo', '../b3.foo'])
+hgt.hg(['status'],
+        stdout='''R bar/bar/b3.foo
+R bar/bar/n3.foo
+''')
+hgt.hg(['commit', '-m', 'forget files'])
+hgt.hg(['status'],
+        stdout='''? bar/bar/b3.foo
+? bar/bar/n3.foo
+''')
+hgt.hg(['forget', 'glob:*.txt'],
+        stdout='''removing n2.txt
+removing b2.txt
+''')
+hgt.hg(['status'],
+        stdout='''R bar/bar/foo/b2.txt
+R bar/bar/foo/n2.txt
+? bar/bar/b3.foo
+? bar/bar/n3.foo
+''')
+hgt.hg(['commit', '-m', 'forget files'])
+hgt.hg(['status'],
+        stdout='''? bar/bar/b3.foo
+? bar/bar/foo/b2.txt
+? bar/bar/foo/n2.txt
+? bar/bar/n3.foo
+''')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-forget.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-forget.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,52 @@
+% setup
+hg init -q
+hg add -q normal1 sub/normal2 sub/normal3.txt sub/normal4.txt
+hg commit -m 'add normal files'
+
+% add lfiles
+hg add -q --large big1 sub/big2 sub/big3.txt
+hg commit -m 'added lfiles'
+
+% forget sub/*.txt
+hg forget 'glob:sub/*.txt'
+hg status
+hg commit -m 'forget lfiles'
+
+% test update
+hg up -r 1
+hg up
+
+% forget single normal files
+hg forget normal1
+hg forget sub/normal2
+hg status
+
+% forget single lfiles
+hg forget big1
+hg forget sub/big2
+hg status
+hg commit -m 'all gone'
+hg status
+
+% setup
+hg init
+hg add n1 n2.txt ../n3.foo
+hg add --large b1 b2.txt ../b3.foo
+hg status
+hg commit -m 'add files'
+
+% test forget and add
+hg forget 'glob:../*.foo'
+hg status
+hg add ../n3.foo
+hg add --large ../b3.foo
+hg status
+hg commit -m 'did i change things?'
+hg forget ../n3.foo ../b3.foo
+hg status
+hg commit -m 'forget files'
+hg status
+hg forget 'glob:*.txt'
+hg status
+hg commit -m 'forget files'
+hg status
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-lockout.t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-lockout.t	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,91 @@
+Setup
+  $ export LARGEFILES="--config extensions.largefiles=$TESTDIR/.."
+  $ export LHG="hg $LARGEFILES"
+
+Non-lfiles clients not locked out from lfiles servers on non-lfiles repos
+  $ mkdir r1
+  $ cd r1
+  $ hg init
+  $ echo c1 > f1
+  $ hg add f1
+  $ hg com -m "m1"
+  $ cd ..
+  $ $LHG serve -R r1 -d -p $HGPORT --pid-file serve.pid
+  $ hg clone http://localhost:$HGPORT r2
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ kill $(cat serve.pid)
+
+lfiles clients still work with non-lfiles servers
+  $ hg serve -R r1 -d -p $HGPORT --pid-file serve.pid
+  $ $LHG clone http://localhost:$HGPORT r3
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ kill $(cat serve.pid)
+
+Non-lfiles clients locked out from lfiles servers serving lfiles repos
+  $ mkdir r4
+  $ cd r4
+  $ $LHG init
+  $ echo c1 > f1
+  $ $LHG add --large f1
+  $ $LHG com -m "m1"
+  $ cd ..
+  $ $LHG serve -R r4 -d -p $HGPORT --pid-file serve.pid
+  $ hg clone http://localhost:$HGPORT r5
+  abort: remote error:
+  
+  This repository uses the largefiles extension.
+  
+  Please enable it in your Mercurial config file.
+  [255]
+  $ kill $(cat serve.pid)
+
+Same thing for ssh clones
+  $ hg clone -e "python $TESTDIR/dummyssh" --remotecmd "$LHG" ssh://user@dummy/r4 r5
+  abort: remote error:
+  
+  This repository uses the largefiles extension.
+  
+  Please enable it in your Mercurial config file.
+  [255]
+
+lfiles clients refuse to push lfiles repos to non-lfiles servers
+  $ mkdir r6
+  $ cd r6
+  $ $LHG init
+  $ echo c1 > f1
+  $ $LHG add f1
+  $ $LHG com -m "m1"
+  $ cat >> .hg/hgrc <<!
+  > [web]
+  > push_ssl = false
+  > allow_push = *
+  > !
+  $ cd ..
+  $ $LHG clone r6 r7
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd r7
+  $ echo c2 > f2
+  $ $LHG add --large f2
+  $ $LHG com -m "m2"
+  $ hg -R ../r6 serve -d -p $HGPORT --pid-file ../serve.pid
+  $ $LHG push http://localhost:$HGPORT
+  pushing to http://localhost:$HGPORT/
+  searching for changes
+  abort: ('%s does not appear to be a lfile store', 'http://localhost:$HGPORT/')
+  [255]
+  $ cd ..
+  $ kill $(cat serve.pid)
+
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-log.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-log.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,192 @@
+#!/usr/bin/env python
+#
+# Test hg log -v, etc.
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+hgt.writefile('n1', 'n1')
+hgt.hg(['add', 'n1'])
+hgt.hg(['commit', '-m', 'add file'])
+hgt.writefile('b1', 'b1')
+hgt.hg(['add', '--large', 'b1'])
+hgt.hg(['commit', '-m', 'add lfile'])
+hgt.writefile('n1', 'n11')
+hgt.hg(['commit', '-m', 'modify file'])
+hgt.writefile('b1', 'b11')
+hgt.hg(['commit', '-m', 'modify lfile'])
+hgt.hg(['rm', 'n1'])
+hgt.hg(['commit', '-m', 'remove file'])
+hgt.hg(['rm', 'b1'])
+hgt.hg(['commit', '-m', 'remove lfile'])
+hgt.hg(['log', '-v'], stdout='''changeset:   5:a24be4cb5b24
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+files:       b1
+description:
+remove lfile
+
+
+changeset:   4:9ee7fc1100a5
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+files:       n1
+description:
+remove file
+
+
+changeset:   3:76948c83b1c2
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+files:       b1
+description:
+modify lfile
+
+
+changeset:   2:82a8e16fae63
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+files:       n1
+description:
+modify file
+
+
+changeset:   1:a3bc2fcca919
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+files:       b1
+description:
+add lfile
+
+
+changeset:   0:10e46e544c56
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+files:       n1
+description:
+add file
+
+
+''')
+hgt.hg(['log', '-p'], stdout='''changeset:   5:a24be4cb5b24
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     remove lfile
+
+diff -r 9ee7fc1100a5 -r a24be4cb5b24 b1
+Binary file b1 has changed
+
+changeset:   4:9ee7fc1100a5
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     remove file
+
+diff -r 76948c83b1c2 -r 9ee7fc1100a5 n1
+--- a/n1	Thu Jan 01 00:00:00 1970 +0000
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,1 +0,0 @@
+-n11
+\ No newline at end of file
+
+changeset:   3:76948c83b1c2
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     modify lfile
+
+diff -r 82a8e16fae63 -r 76948c83b1c2 b1
+Binary file b1 has changed
+
+changeset:   2:82a8e16fae63
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     modify file
+
+diff -r a3bc2fcca919 -r 82a8e16fae63 n1
+--- a/n1	Thu Jan 01 00:00:00 1970 +0000
++++ b/n1	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,1 +1,1 @@
+-n1
+\ No newline at end of file
++n11
+\ No newline at end of file
+
+changeset:   1:a3bc2fcca919
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add lfile
+
+diff -r 10e46e544c56 -r a3bc2fcca919 b1
+Binary file b1 has changed
+
+changeset:   0:10e46e544c56
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add file
+
+diff -r 000000000000 -r 10e46e544c56 n1
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/n1	Thu Jan 01 00:00:00 1970 +0000
+@@ -0,0 +1,1 @@
++n1
+\ No newline at end of file
+
+''')
+hgt.hg(['log', '--stat'], stdout='''changeset:   5:a24be4cb5b24
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     remove lfile
+
+ b1 |    0 
+ 1 files changed, 0 insertions(+), 0 deletions(-)
+
+changeset:   4:9ee7fc1100a5
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     remove file
+
+ n1 |  1 -
+ 1 files changed, 0 insertions(+), 1 deletions(-)
+
+changeset:   3:76948c83b1c2
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     modify lfile
+
+ b1 |    0 
+ 1 files changed, 0 insertions(+), 0 deletions(-)
+
+changeset:   2:82a8e16fae63
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     modify file
+
+ n1 |  2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+changeset:   1:a3bc2fcca919
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add lfile
+
+ b1 |    0 
+ 1 files changed, 0 insertions(+), 0 deletions(-)
+
+changeset:   0:10e46e544c56
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add file
+
+ n1 |  1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+''')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-log.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-log.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,15 @@
+% setup
+hg init
+hg add n1
+hg commit -m 'add file'
+hg add --large b1
+hg commit -m 'add lfile'
+hg commit -m 'modify file'
+hg commit -m 'modify lfile'
+hg rm n1
+hg commit -m 'remove file'
+hg rm b1
+hg commit -m 'remove lfile'
+hg log -v
+hg log -p
+hg log --stat
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-outgoing.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-outgoing.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+#
+# Test summary
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+hgt.writefile('n1', 'n1')
+hgt.writefile('b1', 'b1')
+os.mkdir('dir')
+hgt.writefile('dir/n2', 'n2')
+hgt.writefile('dir/b2', 'b2')
+hgt.hg(['add', 'n1', 'dir/n2'])
+hgt.hg(['add', '--large'],
+        stdout='''adding b1 as a largefile
+adding dir/b2 as a largefile
+''')
+hgt.hg(['commit', '-m', 'add files'])
+os.chdir('..')
+hgt.hg(['clone', 'repo1', 'repo2'],
+        stdout='''updating to branch default
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+os.chdir('repo2')
+hgt.writefile('n1', 'n11')
+hgt.writefile('b1', 'b11')
+hgt.hg(['commit', '-m', 'edit files'])
+os.chdir('..')
+
+hgt.announce('outgoing')
+os.chdir('repo1')
+if common.version >= (1, 8, 0):
+    hgt.hg(['out'], status=255, stdout='comparing with default-push\n', stderr='abort: repository default-push not found!\n')
+    hgt.hg(['out', '--large'], status=255, stdout='comparing with default-push\n', stderr='abort: repository default-push not found!\n')
+else:
+    hgt.hg(['out'], status=255, stderr='abort: repository default-push not found!\n')
+    hgt.hg(['out', '--large'], status=255, stderr='abort: repository default-push not found!\n')
+os.chdir('../repo2')
+hgt.hg(['out'],
+        stdout='''comparing with $HGTMP/test-outgoing.py/repo1
+searching for changes
+changeset:   1:ffc34ec08c25
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     edit files
+
+''')
+hgt.hg(['out', '--large'],
+        stdout='''comparing with $HGTMP/test-outgoing.py/repo1
+searching for changes
+changeset:   1:ffc34ec08c25
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     edit files
+
+searching for changes
+largefiles to upload:
+b1
+
+''')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-outgoing.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-outgoing.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,13 @@
+% setup
+hg init
+hg add n1 dir/n2
+hg add --large
+hg commit -m 'add files'
+hg clone repo1 repo2
+hg commit -m 'edit files'
+
+% outgoing
+hg out
+hg out --large
+hg out
+hg out --large
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-permissions.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-permissions.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,163 @@
+#!/usr/bin/env python
+
+# Test various tricky bfadd corner cases.
+
+import os
+import common
+import stat
+
+hgt = common.LfilesTester()
+
+windows = os.name == 'nt'
+
+mask = stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO
+
+# add size and patterns for adding as largefiles
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+hgt.writefile('n1', 'n1')
+hgt.writefile('b1', 'b1')
+os.mkdir('dir')
+os.mkdir('dir/dir')
+hgt.writefile('dir/n2', 'n2')
+hgt.writefile('dir/b2', 'b2')
+hgt.writefile('dir/dir/n3', 'n3')
+hgt.writefile('dir/dir/b3', 'n3')
+hgt.hg(['add', 'n1', 'dir/n2', 'dir/dir/n3'])
+hgt.hg(['add', '--large', 'b1', 'dir/b2', 'dir/dir/b3'])
+os.chmod('n1', 0755)
+os.chmod('dir/n2', 0644)
+os.chmod('dir/dir/n3', 0755)
+os.chmod('b1', 0755)
+os.chmod('dir/b2', 0644)
+os.chmod('dir/dir/b3', 0755)
+hgt.hg(['commit', '-m', 'initial add'])
+if windows:
+    hgt.asserttrue(os.stat('n1').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('b1').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/b1').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('dir/n2').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('dir/b2').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/dir/b2').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('dir/dir/n3').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('dir/dir/b3').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/dir/dir/b3').st_mode & mask == 0666, 'permissions dont match')
+else:
+    hgt.asserttrue(os.stat('n1').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('b1').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/b1').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('dir/n2').st_mode & mask == 0644, 'permissions dont match')
+    hgt.asserttrue(os.stat('dir/b2').st_mode & mask == 0644, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/dir/b2').st_mode & mask == 0644, 'permissions dont match')
+    hgt.asserttrue(os.stat('dir/dir/n3').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('dir/dir/b3').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/dir/dir/b3').st_mode & mask == 0755, 'permissions dont match')
+
+hgt.hg(['mv', 'dir', 'foo'],
+        stdout='''moving dir/dir/n3 to foo/dir/n3
+moving dir/n2 to foo/n2
+moving .hglf/dir/b2 to .hglf/foo/b2
+moving .hglf/dir/dir/b3 to .hglf/foo/dir/b3
+''')
+hgt.hg(['commit', '-m' ,'move files'])
+if windows:
+    hgt.asserttrue(os.stat('n1').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('b1').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/b1').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/n2').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/b2').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/foo/b2').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/dir/n3').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/dir/b3').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/foo/dir/b3').st_mode & mask == 0666, 'permissions dont match')
+else:
+    hgt.asserttrue(os.stat('n1').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('b1').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/b1').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/n2').st_mode & mask == 0644, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/b2').st_mode & mask == 0644, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/foo/b2').st_mode & mask == 0644, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/dir/n3').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/dir/b3').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/foo/dir/b3').st_mode & mask == 0755, 'permissions dont match')
+
+os.chmod('n1', 0644)
+os.chmod('b1', 0644)
+os.chmod('foo/n2', 0755)
+os.chmod('foo/b2', 0755)
+
+# Also change a file so on windows there are changes
+hgt.writefile('foo/dir/n3', 'n33')
+hgt.writefile('foo/dir/n3', 'b33')
+hgt.hg(['commit', '-m', 'change permissions'])
+if windows:
+    hgt.asserttrue(os.stat('n1').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('b1').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/b1').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/n2').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/b2').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/foo/b2').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/dir/n3').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/dir/b3').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/foo/dir/b3').st_mode & mask == 0666, 'permissions dont match')
+else:
+    hgt.asserttrue(os.stat('n1').st_mode & mask == 0644, 'permissions dont match')
+    hgt.asserttrue(os.stat('b1').st_mode & mask == 0644, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/b1').st_mode & mask == 0644, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/n2').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/b2').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/foo/b2').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/dir/n3').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/dir/b3').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/foo/dir/b3').st_mode & mask == 0755, 'permissions dont match')
+
+if windows:
+    hgt.hg(['backout', '-r', '2'],
+        stdout='''getting changed largefiles
+0 largefiles updated, 0 removed
+reverting foo/dir/n3
+changeset 3:ec78d51da14e backs out changeset 2:a1b9f52f7dce
+''')
+else:
+    hgt.hg(['backout', '-r', '2'],
+        stdout='''getting changed largefiles
+0 largefiles updated, 0 removed
+reverting .hglf/b1
+reverting .hglf/foo/b2
+reverting foo/dir/n3
+reverting foo/n2
+reverting n1
+changeset 3:ec78d51da14e backs out changeset 2:a1b9f52f7dce
+''')
+if windows:
+    hgt.asserttrue(os.stat('n1').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('b1').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/b1').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/n2').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/b2').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/foo/b2').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/dir/n3').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/dir/b3').st_mode & mask == 0666, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/foo/dir/b3').st_mode & mask == 0666, 'permissions dont match')
+else:
+    hgt.asserttrue(os.stat('n1').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('b1').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/b1').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/n2').st_mode & mask == 0644, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/b2').st_mode & mask == 0644, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/foo/b2').st_mode & mask == 0644, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/dir/n3').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('foo/dir/b3').st_mode & mask == 0755, 'permissions dont match')
+    hgt.asserttrue(os.stat('.hglf/foo/dir/b3').st_mode & mask == 0755, 'permissions dont match')
+
+os.chdir('..')
+hgt.hg(['clone', 'repo1', 'repo2'],
+        stdout='''updating to branch default
+6 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+3 largefiles updated, 0 removed
+''')
+common.checkrepos(hgt, 'repo1', 'repo2', [0, 1, 2, 3])
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-permissions.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-permissions.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,10 @@
+% setup
+hg init
+hg add n1 dir/n2 dir/dir/n3
+hg add --large b1 dir/b2 dir/dir/b3
+hg commit -m 'initial add'
+hg mv dir foo
+hg commit -m 'move files'
+hg commit -m 'change permissions'
+hg backout -r 2
+hg clone repo1 repo2
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-purge.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-purge.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+# Test hg purge
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+hgt.updaterc({'extensions': [('purge', '')]})
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+hgt.writefile('b1', 'b1')
+hgt.writefile('n1', 'n1')
+hgt.writefile('n2', 'n2')
+hgt.hg(['add', '--large', 'b1'])
+hgt.hg(['add', 'n1'])
+hgt.hg(['commit', '-m', 'add some files'])
+hgt.hg(['purge'])
+hgt.asserttrue(os.path.exists('b1'), 'missing b1')
+hgt.asserttrue(hgt.readfile('b1') == 'b1', 'wrong file contents')
+hgt.writefile('b2', 'b2')
+hgt.hg(['purge'])
+hgt.assertfalse(os.path.exists('b2'), 'failed to purge b2')
+hgt.writefile('b2', 'b2')
+hgt.hg(['add', '--large', 'b2'])
+hgt.hg(['purge'])
+hgt.asserttrue(os.path.exists('b2'), 'missing b2')
+hgt.asserttrue(hgt.readfile('b2') == 'b2', 'wrong file contents')
+hgt.hg(['commit', '-m', 'add another lfile'])
+hgt.writefile('b2', 'b22')
+hgt.hg(['purge'])
+hgt.asserttrue(os.path.exists('b2'), 'missing b2')
+hgt.asserttrue(hgt.readfile('b2') == 'b22', 'wrong file contents')
+os.chdir('..')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-purge.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-purge.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,11 @@
+% setup
+hg init
+hg add --large b1
+hg add n1
+hg commit -m 'add some files'
+hg purge
+hg purge
+hg add --large b2
+hg purge
+hg commit -m 'add another lfile'
+hg purge
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-pushpull.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-pushpull.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,390 @@
+#!/usr/bin/env python
+
+# Test push pull
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+# add size and patterns for adding as largefiles
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+os.mkdir('dir')
+hgt.writefile('b1', 'b1')
+hgt.writefile('n1', 'n1')
+hgt.writefile('dir/b2', 'b2')
+hgt.writefile('dir/n2', 'n2')
+hgt.hg(['add', '--large', 'b1', 'dir/b2'])
+hgt.hg(['add', 'n1', 'dir/n2'])
+hgt.hg(['commit', '-m', 'added files'])
+os.chdir('..')
+hgt.hg(['clone', 'repo1', 'repo2'],
+        stdout='''updating to branch default
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+common.checkrepos(hgt, 'repo1', 'repo2', [0])
+
+hgt.announce('push and merge')
+os.chdir('repo2')
+hgt.writefile('dir/b2', 'b3')
+hgt.writefile('dir/n2', 'n3')
+hgt.writefile('b3', 'b3')
+hgt.writefile('n3', 'n3')
+hgt.hg(['add', '--large', 'b3'])
+hgt.hg(['add', 'n3'])
+hgt.hg(['commit', '-m', 'changed and add'])
+os.chdir('../repo1')
+hgt.writefile('b1', 'b2')
+hgt.writefile('n1', 'n2')
+hgt.writefile('dir/b4', 'b4')
+hgt.writefile('dir/n4', 'n4')
+hgt.hg(['add', '--large', 'dir/b4'])
+hgt.hg(['add', 'dir/n4'])
+hgt.hg(['commit', '-m', 'changed and add'])
+hgt.hg(['pull', '../repo2'],
+        stdout='''pulling from ../repo2
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 4 changes to 4 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+''')
+hgt.hg(['merge'],
+        stdout='''4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+hgt.asserttrue(os.path.exists('b3'), 'merged lfile should exist')
+hgt.asserttrue(os.path.exists('.hglf/b3'), 'merged lfile should exist')
+hgt.hg(['commit', '-m', 'merge'])
+hgt.hg(['push', '../repo2'],
+        stdout='''pushing to ../repo2
+searching for changes
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 2 changesets with 4 changes to 4 files
+''')
+os.chdir('..')
+common.checkrepos(hgt, 'repo1', 'repo2', [0, 3])
+
+hgt.announce('just push')
+os.chdir('repo2')
+hgt.hg(['remove', 'b3'])
+hgt.writefile('b1', 'tomrocks')
+hgt.hg(['commit', '-m', 'update files'])
+hgt.hg(['push', '../repo1'],
+        stdout='''pushing to ../repo1
+searching for changes
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files
+''')
+os.chdir('..')
+common.checkrepos(hgt, 'repo1', 'repo2', [0, 3, 4])
+
+os.chdir('repo1')
+hgt.writefile('dir/b1.foo', 'foo1')
+hgt.writefile('dir/b2.foo', 'foo1')
+hgt.writefile('dir/b3.foo', 'foo1')
+hgt.writefile('dir/b4.foo', 'foo1')
+hgt.writefile('dir/b5', 'should not add')
+hgt.writefile('dir/blahblah', 'should not add')
+hgt.writefile('dir/stuffnthings', 'should not add')
+hgt.hg(['add', '--large', 'glob:**.foo'],
+        stdout='''adding dir/b1.foo as a largefile
+adding dir/b2.foo as a largefile
+adding dir/b3.foo as a largefile
+adding dir/b4.foo as a largefile
+''')
+hgt.hg(['commit', '-m', 'add some files'])
+hgt.hg(['status', '-A'],
+        stdout='''? dir/b5
+? dir/blahblah
+? dir/stuffnthings
+C b1
+C dir/b1.foo
+C dir/b2
+C dir/b2.foo
+C dir/b3.foo
+C dir/b4
+C dir/b4.foo
+C dir/n2
+C dir/n4
+C n1
+C n3
+''')
+os.unlink('dir/b5')
+os.unlink('dir/blahblah')
+os.unlink('dir/stuffnthings')
+hgt.hg(['status', '-A'],
+        stdout='''C b1
+C dir/b1.foo
+C dir/b2
+C dir/b2.foo
+C dir/b3.foo
+C dir/b4
+C dir/b4.foo
+C dir/n2
+C dir/n4
+C n1
+C n3
+''')
+hgt.hg(['push', '../repo2'],
+        stdout='''pushing to ../repo2
+searching for changes
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 4 changes to 4 files
+''')
+os.chdir('..')
+common.checkrepos(hgt, 'repo1', 'repo2', [0, 3, 4, 5])
+
+hgt.announce('rename edit')
+os.chdir('repo1')
+hgt.writefile('dir/b2.foo', 'foo2')
+hgt.writefile('n1', 'change normal1')
+hgt.hg(['commit', '-m', 'edit b2.foo and n1'])
+os.chdir('../repo2')
+hgt.hg(['rename', 'dir/b2.foo', 'dir/b2222.foo'])
+hgt.hg(['rename', 'n1', 'n1111'])
+hgt.hg(['commit', '-m', 'rename b2.foo and n1'])
+hgt.hg(['pull', '../repo1'],
+        stdout='''pulling from ../repo1
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 2 changes to 2 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+''')
+hgt.hg(['heads'],
+        stdout='''changeset:   7:c93ea8f88a3d
+tag:         tip
+parent:      5:b011fd8471a6
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     edit b2.foo and n1
+
+changeset:   6:081ee8a9082e
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     rename b2.foo and n1
+
+''')
+hgt.hg(['merge'],
+        stdout='''merging dir/b2222.foo and dir/b2.foo to dir/b2222.foo
+merging n1111 and n1 to n1111
+0 files updated, 2 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+getting changed largefiles
+1 largefiles updated, 0 removed
+''')
+hgt.asserttrue(hgt.readfile('dir/b2222.foo') == 'foo2', 'merge failed')
+hgt.hg(['commit', '-m', 'merge'])
+os.chdir('../repo1')
+hgt.hg(['pull', '../repo2'],
+        stdout='''pulling from ../repo2
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 2 changesets with 4 changes to 2 files
+(run 'hg update' to get a working copy)
+''')
+hgt.hg(['up'],
+        stdout='''2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+getting changed largefiles
+1 largefiles updated, 1 removed
+''')
+os.chdir('..')
+common.checkrepos(hgt, 'repo1', 'repo2', [0, 3, 4, 5, 8])
+
+hgt.announce('both edit to same value')
+os.chdir('repo2')
+hgt.writefile('dir/b3.foo', 'change')
+hgt.writefile('n3', 'change')
+# Set date because otherwise the two commits will be identical
+# because the test suite normally changes dates to one value
+hgt.hg(['commit', '-m', 'change dir/b3.foo and n3', '-d', '2007-1-1'])
+os.chdir('../repo1')
+hgt.writefile('dir/b3.foo', 'change')
+hgt.writefile('n3', 'change')
+hgt.hg(['commit', '-m', 'change dir/b3.foo and n3', '-d', '2006-1-1'])
+hgt.hg(['pull', '../repo2'],
+        stdout='''pulling from ../repo2
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 0 changes to 2 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+''')
+hgt.hg(['merge'],
+        stdout='''0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+getting changed largefiles
+0 largefiles updated, 0 removed
+''')
+hgt.hg(['commit', '-m', 'merge'])
+os.chdir('../repo2')
+hgt.hg(['pull', '../repo1'],
+        stdout='''pulling from ../repo1
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 2 changesets with 0 changes to 2 files
+(run 'hg update' to get a working copy)
+''')
+hgt.hg(['up'],
+        stdout='''0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+0 largefiles updated, 0 removed
+''')
+os.chdir('..')
+common.checkrepos(hgt, 'repo1', 'repo2', [0, 3, 4, 5, 8, 11])
+
+hgt.announce('delete edit')
+os.chdir('repo1')
+hgt.hg(['rm', 'dir/b3.foo', 'n3'])
+hgt.hg(['commit', '-m', 'remove dir/b3.foo and n3'])
+os.chdir('../repo2')
+hgt.writefile('dir/b3.foo', 'changechange')
+hgt.writefile('n3', 'changechange')
+hgt.hg(['commit', '-m', 'edit dir/b3.foo and n3'])
+hgt.hg(['pull', '../repo1'],
+        stdout='''pulling from ../repo1
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 0 changes to 0 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+''')
+hgt.hg(['merge'],
+        stdout=''' local changed .hglf/dir/b3.foo which remote deleted
+use (c)hanged version or (d)elete? c
+ local changed n3 which remote deleted
+use (c)hanged version or (d)elete? c
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+getting changed largefiles
+0 largefiles updated, 0 removed
+''')
+hgt.hg(['commit', '-m', 'merge'])
+hgt.hg(['push', '../repo1'],
+        stdout='''pushing to ../repo1
+searching for changes
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 2 changesets with 2 changes to 2 files
+''')
+os.chdir('../repo1')
+hgt.hg(['up'],
+        stdout='''2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+1 largefiles updated, 0 removed
+''')
+os.chdir('..')
+common.checkrepos(hgt, 'repo1', 'repo2', [0, 3, 4, 5, 8, 11, 14])
+
+hgt.announce('copy edit')
+os.chdir('repo1')
+hgt.hg(['cp', 'dir/b3.foo', 'dir/b3333.foo'])
+hgt.hg(['cp', 'n3', 'n3333'])
+hgt.hg(['commit', '-m', 'copy dir/b3.foo and n3'])
+os.chdir('../repo2')
+hgt.writefile('dir/b3.foo', 'changechangechange')
+hgt.writefile('n3', 'changechangechange')
+hgt.hg(['commit', '-m', 'edit dir/b3.foo and n3'])
+hgt.hg(['pull', '../repo1'],
+        stdout='''pulling from ../repo1
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 2 changes to 2 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+''')
+hgt.hg(['merge'],
+        stdout='''merging dir/b3.foo and dir/b3333.foo to dir/b3333.foo
+merging n3 and n3333 to n3333
+0 files updated, 2 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+getting changed largefiles
+1 largefiles updated, 0 removed
+''')
+hgt.asserttrue(hgt.readfile('dir/b3.foo') == 'changechangechange', 'merge failed')
+hgt.asserttrue(hgt.readfile('dir/b3333.foo') == 'changechangechange', 'merge failed')
+hgt.hg(['commit', '-m', 'merge'])
+hgt.hg(['push', '../repo1'],
+        stdout='''pushing to ../repo1
+searching for changes
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 2 changesets with 4 changes to 4 files
+''')
+os.chdir('../repo1')
+hgt.hg(['up'],
+        stdout='''4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+os.chdir('..')
+common.checkrepos(hgt, 'repo1', 'repo2', [0, 3, 4, 5, 8, 11, 14, 17])
+
+hgt.announce('no default path error')
+os.mkdir('repo3')
+os.chdir('repo3')
+hgt.hg(['init'])
+hgt.hg(['pull', '../repo1'],
+        stdout='''pulling from ../repo1
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 18 changesets with 33 changes to 16 files
+(run 'hg update' to get a working copy)
+''')
+hgt.writefile('.hg/hgrc', '''[largefiles]
+systemcache = .
+''')
+hgt.hg(['up'],
+        stdout='''13 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+0 largefiles updated, 0 removed
+''', stderr='''b1: Can't get file locally
+(no default or default-push path set in hgrc)
+dir/b1.foo: Can't get file locally
+(no default or default-push path set in hgrc)
+dir/b2: Can't get file locally
+(no default or default-push path set in hgrc)
+dir/b2222.foo: Can't get file locally
+(no default or default-push path set in hgrc)
+dir/b3.foo: Can't get file locally
+(no default or default-push path set in hgrc)
+dir/b3333.foo: Can't get file locally
+(no default or default-push path set in hgrc)
+dir/b4: Can't get file locally
+(no default or default-push path set in hgrc)
+dir/b4.foo: Can't get file locally
+(no default or default-push path set in hgrc)
+''')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-pushpull.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-pushpull.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,75 @@
+% setup
+hg init
+hg add --large b1 dir/b2
+hg add n1 dir/n2
+hg commit -m 'added files'
+hg clone repo1 repo2
+
+% push and merge
+hg add --large b3
+hg add n3
+hg commit -m 'changed and add'
+hg add --large dir/b4
+hg add dir/n4
+hg commit -m 'changed and add'
+hg pull ../repo2
+hg merge
+hg commit -m merge
+hg push ../repo2
+
+% just push
+hg remove b3
+hg commit -m 'update files'
+hg push ../repo1
+hg add --large 'glob:**.foo'
+hg commit -m 'add some files'
+hg status -A
+hg status -A
+hg push ../repo2
+
+% rename edit
+hg commit -m 'edit b2.foo and n1'
+hg rename dir/b2.foo dir/b2222.foo
+hg rename n1 n1111
+hg commit -m 'rename b2.foo and n1'
+hg pull ../repo1
+hg heads
+hg merge
+hg commit -m merge
+hg pull ../repo2
+hg up
+
+% both edit to same value
+hg commit -m 'change dir/b3.foo and n3' -d 2007-1-1
+hg commit -m 'change dir/b3.foo and n3' -d 2006-1-1
+hg pull ../repo2
+hg merge
+hg commit -m merge
+hg pull ../repo1
+hg up
+
+% delete edit
+hg rm dir/b3.foo n3
+hg commit -m 'remove dir/b3.foo and n3'
+hg commit -m 'edit dir/b3.foo and n3'
+hg pull ../repo1
+hg merge
+hg commit -m merge
+hg push ../repo1
+hg up
+
+% copy edit
+hg cp dir/b3.foo dir/b3333.foo
+hg cp n3 n3333
+hg commit -m 'copy dir/b3.foo and n3'
+hg commit -m 'edit dir/b3.foo and n3'
+hg pull ../repo1
+hg merge
+hg commit -m merge
+hg push ../repo1
+hg up
+
+% no default path error
+hg init
+hg pull ../repo1
+hg up
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-rebase.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-rebase.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,166 @@
+#!/usr/bin/python
+#
+# Test rebasing
+#
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+hgt.writefile('n1', 'n1')
+hgt.hg(['add'],
+        stdout='adding n1\n')
+hgt.hg(['commit', '-m', 'add n1 in repo1'])
+hgt.writefile('b1', 'b1')
+hgt.hg(['add', '--large', 'b1'])
+hgt.hg(['commit', '-m', 'add lfile b1 in repo1'])
+os.chdir('..')
+hgt.hg(['clone', 'repo1', 'repo2'],
+        stdout='''updating to branch default
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+1 largefiles updated, 0 removed
+''')
+os.chdir('repo1')
+hgt.writefile('b1', 'b11')
+hgt.hg(['commit', '-m', 'modify lfile b1 in repo1'])
+os.chdir('../repo2')
+hgt.writefile('n1', 'n11')
+hgt.hg(['commit', '-m', 'modify n1 in repo2'])
+hgt.hg(['pull', '--rebase'],
+        stdout='''pulling from $HGTMP/test-rebase.py/repo1
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files (+1 heads)
+getting changed largefiles
+1 largefiles updated, 0 removed
+saved backup bundle to $HGTMP/test-rebase.py/repo2/.hg/strip-backup/04efa399c7b0-backup.hg
+nothing to rebase
+''')
+hgt.hg(['out', '--large'],
+        stdout='''comparing with $HGTMP/test-rebase.py/repo1
+searching for changes
+changeset:   3:a936f6bd10ee
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     modify n1 in repo2
+
+searching for changes
+largefiles to upload:
+
+''')
+hgt.writefile('n1', 'n111')
+hgt.hg(['commit', '-m', 'modify n1'])
+hgt.hg(['out', '--large'],
+        stdout='''comparing with $HGTMP/test-rebase.py/repo1
+searching for changes
+changeset:   3:a936f6bd10ee
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     modify n1 in repo2
+
+changeset:   4:3845f28dc0b9
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     modify n1
+
+searching for changes
+largefiles to upload:
+
+''')
+hgt.hg(['update', '--clean'],
+        stdout='''0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+0 largefiles updated, 0 removed
+''')
+hgt.asserttrue(hgt.readfile('b1') == 'b11', "file contents don't match")
+
+# Now do the exact same thing with the rebase command instead of pull --rebase
+os.chdir('..')
+os.mkdir('repo3')
+os.chdir('repo3')
+hgt.hg(['init'])
+hgt.writefile('n1', 'n1')
+hgt.hg(['add'],
+        stdout='adding n1\n')
+hgt.hg(['commit', '-m', 'add n1 in repo3'])
+hgt.writefile('b1', 'b1')
+hgt.hg(['add', '--large', 'b1'])
+hgt.hg(['commit', '-m', 'add lfile b1 in repo3'])
+os.chdir('..')
+hgt.hg(['clone', 'repo3', 'repo4'],
+        stdout='''updating to branch default
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+1 largefiles updated, 0 removed
+''')
+os.chdir('repo3')
+hgt.writefile('b1', 'b11')
+hgt.hg(['commit', '-m', 'modify lfile b1 in repo3'])
+os.chdir('../repo4')
+hgt.writefile('n1', 'n11')
+hgt.hg(['commit', '-m', 'modify n1 in repo4'])
+hgt.hg(['pull'],
+        stdout='''pulling from $HGTMP/test-rebase.py/repo3
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files (+1 heads)
+(run \'hg heads\' to see heads, \'hg merge\' to merge)
+''')
+
+hgt.hg(['rebase'],
+        stdout='''getting changed largefiles
+1 largefiles updated, 0 removed
+saved backup bundle to $HGTMP/test-rebase.py/repo4/.hg/strip-backup/e1ea3a163b7e-backup.hg
+''')
+hgt.hg(['out', '--large'],
+        stdout='''comparing with $HGTMP/test-rebase.py/repo3
+searching for changes
+changeset:   3:ecf946a70113
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     modify n1 in repo4
+
+searching for changes
+largefiles to upload:
+
+''')
+hgt.writefile('n1', 'n111')
+hgt.hg(['commit', '-m', 'modify n1'])
+hgt.hg(['out', '--large'],
+        stdout='''comparing with $HGTMP/test-rebase.py/repo3
+searching for changes
+changeset:   3:ecf946a70113
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     modify n1 in repo4
+
+changeset:   4:82807b2f85bd
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     modify n1
+
+searching for changes
+largefiles to upload:
+
+''')
+hgt.hg(['update', '--clean'],
+        stdout='''0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+0 largefiles updated, 0 removed
+''')
+hgt.asserttrue(hgt.readfile('b1') == 'b11', "file contents don't match")
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-rebase.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-rebase.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,28 @@
+% setup
+hg init
+hg add
+hg commit -m 'add n1 in repo1'
+hg add --large b1
+hg commit -m 'add lfile b1 in repo1'
+hg clone repo1 repo2
+hg commit -m 'modify lfile b1 in repo1'
+hg commit -m 'modify n1 in repo2'
+hg pull --rebase
+hg out --large
+hg commit -m 'modify n1'
+hg out --large
+hg update --clean
+hg init
+hg add
+hg commit -m 'add n1 in repo3'
+hg add --large b1
+hg commit -m 'add lfile b1 in repo3'
+hg clone repo3 repo4
+hg commit -m 'modify lfile b1 in repo3'
+hg commit -m 'modify n1 in repo4'
+hg pull
+hg rebase
+hg out --large
+hg commit -m 'modify n1'
+hg out --large
+hg update --clean
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-remove.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-remove.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,161 @@
+#!/usr/bin/env python
+
+# Test remove
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+def rejoin(path):
+    '''convert unix path to local convention'''
+    return os.path.join(*path.split('/'))
+
+# add size and patterns for adding as a largefiles
+hgt.updaterc({'largefiles': [('size', '2'), ('patterns', 'glob:**.dat')]})
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init', '-q'])
+hgt.writefile('normal1', 'foo')
+os.mkdir('sub')
+os.mkdir('sub2')
+hgt.writefile('sub/normal2', 'bar')
+hgt.writefile('sub/normal3.txt', 'bar2')
+hgt.writefile('sub/normal4.txt', 'bar3')
+hgt.hg(['add', '-q', 'normal1', rejoin('sub/normal2'), rejoin('sub/normal3.txt'), rejoin('sub/normal4.txt')])
+hgt.hg(['commit', '-m', 'add normal files'])
+
+hgt.announce('add lfiles')
+hgt.writefile('big1', 'abc')
+hgt.writefile('sub/big2', 'xyz')
+hgt.writefile('sub/big3.txt', 'xyz')
+hgt.writefile('sub/big4', 'xyz')
+hgt.writefile('sub2/big5', 'xyz')
+hgt.hg(['add', '-q', '--large', 'big1', rejoin('sub/big2'), rejoin('sub/big3.txt'), rejoin('sub/big4'), rejoin('sub2/big5')])
+hgt.hg(['commit', '-m', 'added lfiles'])
+
+hgt.announce('remove sub/*.txt')
+hgt.hg(['remove', 'glob:sub/*.txt'],
+        stdout=('removing sub/normal3.txt\n'
+                'removing sub/normal4.txt\n'
+                'removing sub/big3.txt\n'))
+hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists')
+hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big4'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub2/big5'), 'added file doesnt exist')
+hgt.hg(['status'],
+        stdout=('R sub/big3.txt\n'
+                'R sub/normal3.txt\n'
+                'R sub/normal4.txt\n'))
+hgt.hg(['commit', '-m', 'remove lfiles'])
+
+hgt.announce('test update')
+hgt.hg(['up', '-r', '1'],
+        stdout=('3 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '1 largefiles updated, 0 removed\n'))
+hgt.asserttrue(os.path.exists('sub/normal3.txt'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal4.txt'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big3.txt'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big4'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub2/big5'), 'added file doesnt exist')
+hgt.hg(['up'],
+        stdout=('0 files updated, 0 files merged, 3 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '0 largefiles updated, 1 removed\n'))
+hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists')
+hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big4'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub2/big5'), 'added file doesnt exist')
+
+hgt.announce('remove single normal files and add')
+hgt.hg(['remove', 'normal1', 'sub/normal2'])
+hgt.writefile('normal1', 'foo')
+hgt.writefile('sub/normal2', 'bar')
+hgt.hg(['add', 'normal1', 'sub/normal2'])
+hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists')
+hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big4'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub2/big5'), 'added file doesnt exist')
+hgt.hg(['status'])
+
+hgt.announce('remove single lfile and commit with full path')
+hgt.hg(['remove', 'sub/big4'])
+hgt.hg(['status'],stdout=('R sub/big4\n'))
+hgt.hg(['commit', '-m', 'removing big4', 'sub/big4'])
+hgt.assertfalse(os.path.exists('sub/big4'), 'removed file exists')
+hgt.hg(['status'])
+
+hgt.announce('remove single lfile and commit with partial path')
+hgt.hg(['remove', 'sub2/big5'])
+hgt.hg(['status'],stdout=('R sub2/big5\n'))
+hgt.assertfalse(os.path.exists("sub2"), 'removed directory structure exists')
+hgt.hg(['commit', '-m', 'removing big5', 'sub2'])
+hgt.assertfalse(os.path.exists('sub2/big5'), 'removed file exists')
+hgt.hg(['status'])
+
+hgt.announce('remove single lfiles and add')
+hgt.hg(['remove', 'big1', 'sub/big2'])
+hgt.writefile('big1', 'abc')
+hgt.writefile('sub/big2', 'xyz')
+hgt.hg(['add', '--large', 'big1', 'sub/big2'])
+hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists')
+hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist')
+hgt.hg(['status'])
+
+hgt.announce('remove single normal files')
+hgt.hg(['remove', 'normal1'])
+hgt.hg(['remove', 'sub/normal2'])
+hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('normal1'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/normal2'), 'removed file exists')
+hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist')
+hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist')
+hgt.hg(['status'],
+        stdout=('R normal1\n'
+                'R sub/normal2\n'))
+
+hgt.announce('remove single lfiles')
+hgt.hg(['remove', 'big1'])
+hgt.hg(['remove', 'sub/big2'])
+hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists')
+hgt.assertfalse(os.path.exists('normal1'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/normal2'), 'removed file exists')
+hgt.assertfalse(os.path.exists('big1'), 'removed file exists')
+hgt.assertfalse(os.path.exists('sub/big2'), 'removed file exists')
+hgt.hg(['status'],
+        stdout=('R big1\n'
+                'R normal1\n'
+                'R sub/big2\n'
+                'R sub/normal2\n'))
+hgt.hg(['commit', '-m', 'all gone'])
+hgt.hg(['status'])
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-remove.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-remove.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,51 @@
+% setup
+hg init -q
+hg add -q normal1 sub/normal2 sub/normal3.txt sub/normal4.txt
+hg commit -m 'add normal files'
+
+% add lfiles
+hg add -q --large big1 sub/big2 sub/big3.txt sub/big4 sub2/big5
+hg commit -m 'added lfiles'
+
+% remove sub/*.txt
+hg remove 'glob:sub/*.txt'
+hg status
+hg commit -m 'remove lfiles'
+
+% test update
+hg up -r 1
+hg up
+
+% remove single normal files and add
+hg remove normal1 sub/normal2
+hg add normal1 sub/normal2
+hg status
+
+% remove single lfile and commit with full path
+hg remove sub/big4
+hg status
+hg commit -m 'removing big4' sub/big4
+hg status
+
+% remove single lfile and commit with partial path
+hg remove sub2/big5
+hg status
+hg commit -m 'removing big5' sub2
+hg status
+
+% remove single lfiles and add
+hg remove big1 sub/big2
+hg add --large big1 sub/big2
+hg status
+
+% remove single normal files
+hg remove normal1
+hg remove sub/normal2
+hg status
+
+% remove single lfiles
+hg remove big1
+hg remove sub/big2
+hg status
+hg commit -m 'all gone'
+hg status
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-repo1.bundle
Binary file hgext/largefiles/tests/test-repo1.bundle has changed
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-reposetup.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-reposetup.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+# Test that lfiles does not conflict with other extensions
+# (e.g. bookmarks) that override localrepository.commit().
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+hgt.announce('setup')
+
+# enable just bookmarks at first
+hgt.updaterc(
+    extraconfig={'extensions': [('bookmarks', '')]})
+
+hgt.hg(['init', 'repo1'])
+os.chdir('repo1')
+
+hgt.writefile('a', 'a\n', 'wb')
+hgt.hg(['commit', '-A', '-m', 'initial commit'],
+       stdout='adding a\n')
+
+# make the bookmark and show it
+hgt.announce('create a bookmark')
+hgt.hg(['bookmark', 'willmove'])
+hgt.hg(['bookmarks'],
+       stdout=' * willmove                  0:174a8b07abe3\n')
+
+hgt.announce('move bookmark by committing')
+hgt.writefile('a', 'a\n', 'ab')
+hgt.hg(['commit', '-m', 'modify and move bookmark'])
+hgt.hg(['bookmarks'],
+       stdout=' * willmove                  1:7e0cee89986a\n')
+
+hgt.announce('enable lfiles, make another commit, ensure bookmark moved')
+
+# Repeat the entry for bookmarks to ensure that it is loaded after
+# largefiles, since the bug we're testing for here only occurred when
+# largefiles was loaded first.
+hgt.updaterc(
+    extraconfig={'extensions':
+                 [('largefiles', common.LARGEFILESPATH),
+                  ('bookmarks', '')]})
+
+hgt.writefile('a', 'a\n', 'ab')
+hgt.hg(['commit', '-m', 'modify with lfiles enabled'])
+hgt.hg(['bookmarks'],
+       stdout=' * willmove                  2:6077d0e47285\n')
+
+
+
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-reposetup.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-reposetup.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,15 @@
+% setup
+hg init repo1
+hg commit -A -m 'initial commit'
+
+% create a bookmark
+hg bookmark willmove
+hg bookmarks
+
+% move bookmark by committing
+hg commit -m 'modify and move bookmark'
+hg bookmarks
+
+% enable lfiles, make another commit, ensure bookmark moved
+hg commit -m 'modify with lfiles enabled'
+hg bookmarks
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-requires.t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-requires.t	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,121 @@
+Setup
+  $ export LARGEFILES="--config extensions.largefiles=$TESTDIR/.."
+  $ export LHG="hg $LARGEFILES"
+
+Requirement not added to new repos
+  $ mkdir r1
+  $ cd r1
+  $ $LHG init
+  $ grep largefiles .hg/requires
+  [1]
+  $ cd ..
+
+Requirement added to repos with .hglf directories
+  $ mkdir r2
+  $ cd r2
+  $ $LHG init
+  $ mkdir .hglf
+  $ echo "0000000000000000000000000000000000000000" > .hglf/f1
+  $ hg add .hglf/f1
+  $ hg com -m "m1"
+  $ grep largefiles .hg/requires
+  [1]
+  $ $LHG status
+  ! f1
+  $ grep largefiles .hg/requires
+  largefiles
+  $ cd ..
+
+Requirement added when cloning largefiles repos
+  $ mkdir r3
+  $ cd r3
+  $ $LHG init
+  $ echo c1 > f1
+  $ $LHG add --large f1
+  $ $LHG com -m "m1"
+  $ cd ..
+  $ $LHG clone r3 r3c
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting changed largefiles
+  1 largefiles updated, 0 removed
+  $ grep largefiles r3c/.hg/requires
+  largefiles
+
+Requirement added when committing a lfile
+  $ mkdir r4
+  $ cd r4
+  $ $LHG init
+  $ echo c1 > f1
+  $ $LHG add --large f1
+  $ $LHG com -m "m1"
+  $ grep largefiles .hg/requires
+  largefiles
+  $ cd ..
+
+Requirement added when pulling largefiles into a non-largefiles repo
+  $ mkdir r5
+  $ cd r5
+  $ $LHG init
+  $ echo c1 > f1
+  $ $LHG add f1
+  $ $LHG com -m "m1"
+  $ cd ..
+  $ $LHG clone r5 r6
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd r6
+  $ grep largefiles .hg/requires
+  [1]
+  $ echo c2 > f2
+  $ $LHG add --large f2
+  $ $LHG com -m "m2"
+  $ cd ../r5
+  $ $LHG pull ../r6
+  pulling from ../r6
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  (run 'hg update' to get a working copy)
+  $ grep largefiles .hg/requires
+  largefiles
+  $ cd ..
+
+Requirement added when pushing largefiles into a non-largefiles repo
+  $ mkdir r7
+  $ cd r7
+  $ $LHG init
+  $ echo c1 > f1
+  $ $LHG add f1
+  $ $LHG com -m "m1"
+  $ cd ..
+  $ $LHG clone r7 r8
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd r8
+  $ echo c2 > f2
+  $ $LHG add --large f2
+  $ $LHG com -m "m2"
+  $ $LHG push ../r7
+  pushing to ../r7
+  searching for changes
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  $ cd ../r7
+  $ grep largefiles .hg/requires
+  largefiles
+  $ cd ..
+
+Requirement blocks non-largefiles clients
+  $ mkdir r9
+  $ cd r9
+  $ hg init
+  $ echo largefiles >> .hg/requires
+  $ hg st
+  abort: unknown repository format: requires features 'largefiles' (upgrade Mercurial)!
+  [255]
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-revert.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-revert.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,303 @@
+#!/usr/bin/env python
+
+# Test revert
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+def checkfile(file, contents):
+    hgt.asserttrue(hgt.readfile(file) == contents, 'file contents dont match')
+
+# add size and patterns for adding as a largefiles
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+os.mkdir('dir')
+os.mkdir('dir/dir')
+hgt.hg(['init', '-q'])
+hgt.writefile('n1', 'n1')
+hgt.writefile('n2.txt', 'n2')
+hgt.writefile('dir/n3', 'n3')
+hgt.writefile('dir/dir/n4.txt', 'n4')
+hgt.hg(['add', 'n1', 'n2.txt', 'dir/n3', 'dir/dir/n4.txt'])
+hgt.writefile('b1', 'b1')
+hgt.writefile('b2.txt', 'b2')
+hgt.writefile('dir/b3', 'b3')
+hgt.writefile('dir/dir/b4.txt', 'b4')
+hgt.hg(['add', '--large'],
+        stdout=('adding b1 as a largefile\n'
+                'adding b2.txt as a largefile\n'
+                'adding dir/b3 as a largefile\n'
+                'adding dir/dir/b4.txt as a largefile\n'))
+hgt.hg(['status'],
+        stdout=('A b1\n'
+                'A b2.txt\n'
+                'A dir/b3\n'
+                'A dir/dir/b4.txt\n'
+                'A dir/dir/n4.txt\n'
+                'A dir/n3\n'
+                'A n1\n'
+                'A n2.txt\n'))
+hgt.hg(['commit', '-m', 'added files'])
+
+hgt.writefile('n1', 'n2')
+hgt.writefile('n2.txt', 'n3')
+hgt.writefile('dir/n3', 'n4')
+hgt.writefile('dir/dir/n4.txt', 'n5')
+hgt.writefile('b1', 'b2')
+hgt.writefile('b2.txt', 'b3')
+hgt.writefile('dir/b3', 'b4')
+hgt.writefile('dir/dir/b4.txt', 'b5')
+hgt.hg(['commit', '-m', 'edit files'])
+os.mkdir('txtfiles')
+hgt.hg(['rename', 'glob:**.txt', 'txtfiles'],
+        stdout=('moving dir/dir/n4.txt to txtfiles/n4.txt\n'
+                'moving n2.txt to txtfiles/n2.txt\n'
+                'moving .hglf/b2.txt to .hglf/txtfiles/b2.txt\n'
+                'moving .hglf/dir/dir/b4.txt to .hglf/txtfiles/b4.txt\n'))
+hgt.hg(['commit', '-m', 'rename files'])
+hgt.hg(['rm', 'n1', 'dir/b3'])
+hgt.hg(['commit', '-m', 'remove files'])
+
+hgt.announce('revert all')
+hgt.hg(['revert', '-a'])
+hgt.hg(['status'])
+hgt.hg(['revert', '-a', '-r', '0'],
+    stdout='''reverting .hglf/b1
+adding .hglf/b2.txt
+adding .hglf/dir/b3
+adding .hglf/dir/dir/b4.txt
+removing .hglf/txtfiles/b2.txt
+removing .hglf/txtfiles/b4.txt
+adding dir/dir/n4.txt
+reverting dir/n3
+adding n1
+adding n2.txt
+removing txtfiles/n2.txt
+removing txtfiles/n4.txt
+''')
+hgt.asserttrue(hgt.readfile('n1') == 'n1', 'file changed')
+hgt.asserttrue(hgt.readfile('n2.txt') == 'n2', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/n3') == 'n3', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/dir/n4.txt') == 'n4', 'file changed')
+hgt.asserttrue(hgt.readfile('b1') == 'b1', 'file changed')
+hgt.asserttrue(hgt.readfile('b2.txt') == 'b2', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/b3') == 'b3', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/dir/b4.txt') == 'b4', 'file changed')
+hgt.assertfalse(os.path.exists('txtfiles/n2.txt'), 'file shouldnt exist')
+hgt.assertfalse(os.path.exists('txtfiles/n4.txt'), 'file shouldnt exist')
+hgt.assertfalse(os.path.exists('txtfiles/b2.txt'), 'file shouldnt exist')
+hgt.assertfalse(os.path.exists('txtfiles/b4.txt'), 'file shouldnt exist')
+
+hgt.hg(['status'],
+        stdout='''M b1
+M dir/n3
+A b2.txt
+A dir/b3
+A dir/dir/b4.txt
+A dir/dir/n4.txt
+A n1
+A n2.txt
+R txtfiles/b2.txt
+R txtfiles/b4.txt
+R txtfiles/n2.txt
+R txtfiles/n4.txt
+''')
+hgt.hg(['revert', '-a'],
+        stdout='''reverting .hglf/b1
+forgetting .hglf/b2.txt
+forgetting .hglf/dir/b3
+forgetting .hglf/dir/dir/b4.txt
+undeleting .hglf/txtfiles/b2.txt
+undeleting .hglf/txtfiles/b4.txt
+forgetting dir/dir/n4.txt
+reverting dir/n3
+forgetting n1
+forgetting n2.txt
+undeleting txtfiles/n2.txt
+undeleting txtfiles/n4.txt
+''')
+hgt.asserttrue(hgt.readfile('n1') == 'n1', 'file changed')
+hgt.asserttrue(hgt.readfile('n2.txt') == 'n2', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/n3') == 'n4', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/n3.orig') == 'n3', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/dir/n4.txt') == 'n4', 'file changed')
+hgt.asserttrue(hgt.readfile('b1') == 'b2', 'file changed')
+hgt.asserttrue(hgt.readfile('b1.orig') == 'b1', 'file changed')
+hgt.asserttrue(hgt.readfile('b2.txt') == 'b2', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/b3') == 'b3', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/dir/b4.txt') == 'b4', 'file changed')
+hgt.asserttrue(hgt.readfile('txtfiles/n2.txt') == 'n3', 'file changed')
+hgt.asserttrue(hgt.readfile('txtfiles/n4.txt') == 'n5', 'file changed')
+hgt.asserttrue(hgt.readfile('txtfiles/b2.txt') == 'b3', 'file changed')
+hgt.asserttrue(hgt.readfile('txtfiles/b4.txt') == 'b5', 'file changed')
+hgt.hg(['status'],
+        stdout='''? b1.orig
+? b2.txt
+? dir/b3
+? dir/dir/b4.txt
+? dir/dir/n4.txt
+? dir/n3.orig
+? n1
+? n2.txt
+''')
+os.unlink('b1.orig')
+os.unlink('b2.txt')
+os.unlink('dir/dir/b4.txt')
+os.unlink('dir/dir/n4.txt')
+os.unlink('dir/n3.orig')
+os.unlink('n1')
+os.unlink('n2.txt')
+os.unlink('dir/b3')
+os.unlink('.hglf/b1.orig')
+
+hgt.announce('revert specific files')
+hgt.hg(['revert', '-r', '1', 'glob:**.txt'],
+        stdout='''adding .hglf/b2.txt
+adding .hglf/dir/dir/b4.txt
+removing .hglf/txtfiles/b2.txt
+removing .hglf/txtfiles/b4.txt
+adding dir/dir/n4.txt
+adding n2.txt
+removing txtfiles/n2.txt
+removing txtfiles/n4.txt
+''')
+hgt.asserttrue(hgt.readfile('n2.txt') == 'n3', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/n3') == 'n4', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/dir/n4.txt') == 'n5', 'file changed')
+hgt.asserttrue(hgt.readfile('b1') == 'b2', 'file changed')
+hgt.asserttrue(hgt.readfile('b2.txt') == 'b3', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/dir/b4.txt') == 'b5', 'file changed')
+hgt.assertfalse(os.path.exists('txtfiles/n2.txt'), 'file shouldnt exist')
+hgt.assertfalse(os.path.exists('txtfiles/n4.txt'), 'file shouldnt exist')
+hgt.assertfalse(os.path.exists('txtfiles/b2.txt'), 'file shouldnt exist')
+hgt.assertfalse(os.path.exists('txtfiles/b4.txt'), 'file shouldnt exist')
+hgt.hg(['status'],
+        stdout='''A b2.txt
+A dir/dir/b4.txt
+A dir/dir/n4.txt
+A n2.txt
+R txtfiles/b2.txt
+R txtfiles/b4.txt
+R txtfiles/n2.txt
+R txtfiles/n4.txt
+''')
+hgt.hg(['revert', '-r', '0', 'n2.txt', 'b2.txt'])
+hgt.asserttrue(hgt.readfile('n2.txt') == 'n2', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/n3') == 'n4', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/dir/n4.txt') == 'n5', 'file changed')
+hgt.asserttrue(hgt.readfile('b1') == 'b2', 'file changed')
+hgt.asserttrue(hgt.readfile('b2.txt') == 'b2', 'file changed')
+hgt.asserttrue(hgt.readfile('dir/dir/b4.txt') == 'b5', 'file changed')
+hgt.assertfalse(os.path.exists('txtfiles/n2.txt'), 'file shouldnt exist')
+hgt.assertfalse(os.path.exists('txtfiles/n4.txt'), 'file shouldnt exist')
+hgt.assertfalse(os.path.exists('txtfiles/b2.txt'), 'file shouldnt exist')
+hgt.assertfalse(os.path.exists('txtfiles/b4.txt'), 'file shouldnt exist')
+hgt.hg(['status'],
+        stdout='''A b2.txt
+A dir/dir/b4.txt
+A dir/dir/n4.txt
+A n2.txt
+R txtfiles/b2.txt
+R txtfiles/b4.txt
+R txtfiles/n2.txt
+R txtfiles/n4.txt
+? b2.txt.orig
+? n2.txt.orig
+''')
+# Test that modifying a normal file and a lfile, then reverting the normal file,
+# does not alter the lfile
+os.chdir('..')
+os.mkdir('repo2')
+os.chdir('repo2')
+hgt.hg(['init', '-q'])
+hgt.writefile('n1', 'n1')
+hgt.hg(['add', 'n1'])
+hgt.hg(['commit', '-m', 'added normal file'])
+hgt.writefile('b1', 'b1')
+hgt.hg(['add', '--large',  'b1'])
+hgt.hg(['commit', '-m', 'added lfile'])
+hgt.writefile('n1', 'n11')
+hgt.writefile('b1', 'b11')
+hgt.hg(['revert', 'n1'])
+hgt.asserttrue(hgt.readfile('b1') == 'b11', 'file changed')
+# Test that modifying 2 lfiles and reverting one of the lfiles, does not alter the
+# second lfile
+os.chdir('..')
+os.mkdir('repo3')
+os.chdir('repo3')
+hgt.hg(['init', '-q'])
+hgt.writefile('b1', 'b1')
+hgt.hg(['add', '--large',  'b1'])
+hgt.hg(['commit', '-m', 'added first lfile'])
+hgt.writefile('b2', 'b2')
+hgt.hg(['add', '--large',  'b2'])
+hgt.hg(['commit', '-m', 'added second lfile'])
+hgt.writefile('b1', 'b11')
+hgt.writefile('b2', 'b22')
+hgt.hg(['revert', 'b1'])
+hgt.asserttrue(hgt.readfile('b2') == 'b22', 'file changed')
+# Test that a newly added, uncommitted lfile can be reverted
+hgt.announce('revert uncommitted files')
+os.chdir('..')
+os.mkdir('repo4')
+os.chdir('repo4')
+hgt.hg(['init', '-q'])
+hgt.writefile('n1', 'n1')
+hgt.hg(['add', 'n1'])
+hgt.hg(['commit', '-m', 'add normal file'])
+hgt.writefile('b1', 'b1')
+hgt.hg(['add', '--large', 'b1'])
+hgt.hg(['revert', 'b1'])
+hgt.hg(['status'], stdout='''? b1
+''')
+hgt.hg(['add', 'b1'])
+hgt.hg(['status'], stdout='''A b1
+''')
+hgt.hg(['revert', 'b1'])
+hgt.hg(['add', '--large', 'b1'])
+hgt.hg(['revert', '--all'], stdout='''forgetting .hglf/b1
+''')
+hgt.hg(['status'], stdout='''? b1
+''')
+hgt.hg(['add', 'b1'])
+hgt.hg(['status'], stdout='''A b1
+''')
+hgt.hg(['revert', 'b1'])
+hgt.hg(['add', '--large', 'b1'])
+hgt.hg(['commit', '-m', 'add lfile'])
+hgt.writefile('b2', 'b2')
+hgt.writefile('b3', 'b3')
+hgt.hg(['add', '--large', 'b2'])
+hgt.hg(['revert', 'b2'])
+hgt.hg(['status'], stdout='''? b2
+? b3
+''')
+hgt.hg(['add', '--large', 'b2'])
+hgt.hg(['revert', '--all'], stdout='''forgetting .hglf/b2
+''')
+hgt.hg(['status'], stdout='''? b2
+? b3
+''')
+hgt.hg(['add', '--large'], stdout='''adding b2 as a largefile
+adding b3 as a largefile
+''')
+hgt.hg(['revert', 'b3'])
+hgt.hg(['status'], stdout='''A b2
+? b3
+''')
+hgt.hg(['commit', '-m', 'add another lfile'])
+hgt.hg(['rm', 'b2'])
+hgt.assertfalse(os.path.exists('b2'), 'file shouldnt exist')
+hgt.assertfalse(os.path.exists('.hglf/b2'), 'file shouldnt exist')
+hgt.hg(['revert', 'b2'])
+hgt.asserttrue(hgt.readfile('b2') == 'b2', 'file changed')
+hgt.asserttrue(hgt.readfile('.hglf/b2') == '32f28ea03b1b20126629d2ca63fc6665b0bbb604\n', 'file changed')
+hgt.hg(['rm', 'b2'])
+hgt.hg(['revert', '--all'], stdout='''undeleting .hglf/b2
+''')
+hgt.asserttrue(hgt.readfile('b2') == 'b2', 'file changed')
+hgt.asserttrue(hgt.readfile('.hglf/b2') == '32f28ea03b1b20126629d2ca63fc6665b0bbb604\n', 'file changed')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-revert.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-revert.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,70 @@
+% setup
+hg init -q
+hg add n1 n2.txt dir/n3 dir/dir/n4.txt
+hg add --large
+hg status
+hg commit -m 'added files'
+hg commit -m 'edit files'
+hg rename 'glob:**.txt' txtfiles
+hg commit -m 'rename files'
+hg rm n1 dir/b3
+hg commit -m 'remove files'
+
+% revert all
+hg revert -a
+hg status
+hg revert -a -r 0
+hg status
+hg revert -a
+hg status
+
+% revert specific files
+hg revert -r 1 'glob:**.txt'
+hg status
+hg revert -r 0 n2.txt b2.txt
+hg status
+hg init -q
+hg add n1
+hg commit -m 'added normal file'
+hg add --large b1
+hg commit -m 'added lfile'
+hg revert n1
+hg init -q
+hg add --large b1
+hg commit -m 'added first lfile'
+hg add --large b2
+hg commit -m 'added second lfile'
+hg revert b1
+
+% revert uncommitted files
+hg init -q
+hg add n1
+hg commit -m 'add normal file'
+hg add --large b1
+hg revert b1
+hg status
+hg add b1
+hg status
+hg revert b1
+hg add --large b1
+hg revert --all
+hg status
+hg add b1
+hg status
+hg revert b1
+hg add --large b1
+hg commit -m 'add lfile'
+hg add --large b2
+hg revert b2
+hg status
+hg add --large b2
+hg revert --all
+hg status
+hg add --large
+hg revert b3
+hg status
+hg commit -m 'add another lfile'
+hg rm b2
+hg revert b2
+hg rm b2
+hg revert --all
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-rollback.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-rollback.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+#
+# Test rollback
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init', '-q'])
+hgt.writefile('b1', 'b1')
+hgt.hg(['add', '--large', 'b1'])
+hgt.hg(['commit', '-m', 'add lfile'])
+hgt.hg(['rollback'],
+        stdout='''repository tip rolled back to revision -1 (undo commit)
+working directory now based on revision -1
+''')
+hgt.hg(['status'], stdout='''A b1
+''')
+hgt.hg(['commit', '-m', 'add lfile'])
+hgt.writefile('b2', 'b2')
+hgt.hg(['add', '--large', 'b2'])
+hgt.hg(['commit', '-m', 'add another lfile'])
+hgt.hg(['rollback'],
+        stdout='''repository tip rolled back to revision 0 (undo commit)
+working directory now based on revision 0
+''')
+hgt.hg(['status'], stdout='''A b2
+''')
+hgt.hg(['commit', '-m', 'add another lfile'])
+hgt.writefile('b2', 'b22')
+hgt.hg(['commit', '-m', 'modify lfile'])
+hgt.hg(['rollback'],
+       stdout='''repository tip rolled back to revision 1 (undo commit)
+working directory now based on revision 1
+''')
+hgt.hg(['status'], stdout='''M b2
+''')
+hgt.asserttrue(hgt.readfile('b2') == 'b22', 'file changed')
+hgt.hg(['commit', '-m', 'modify lfile'])
+hgt.hg(['rm', 'b2'])
+hgt.hg(['commit', '-m', 'delete lfile'])
+hgt.hg(['rollback'],
+       stdout='''repository tip rolled back to revision 2 (undo commit)
+working directory now based on revision 2
+''')
+hgt.hg(['status'], stdout='''! b2
+''')
+hgt.asserttrue(hgt.readfile('.hglf/b2') == 'ad280552ca89b1d13baa498ef352e1eabaafdf28\n', 'file changed')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-rollback.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-rollback.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,20 @@
+% setup
+hg init -q
+hg add --large b1
+hg commit -m 'add lfile'
+hg rollback
+hg status
+hg commit -m 'add lfile'
+hg add --large b2
+hg commit -m 'add another lfile'
+hg rollback
+hg status
+hg commit -m 'add another lfile'
+hg commit -m 'modify lfile'
+hg rollback
+hg status
+hg commit -m 'modify lfile'
+hg rm b2
+hg commit -m 'delete lfile'
+hg rollback
+hg status
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-serve.t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-serve.t	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,179 @@
+Setup
+  $ export LARGEFILES='--config extensions.largefiles=$TESTDIR/..'
+  $ export LHG="hg $LARGEFILES"
+
+Clone tests setup
+  $ mkdir r1
+  $ cd r1
+  $ $LHG init
+  $ echo c1 > f1
+  $ echo c2 > f2
+  $ $LHG add --large f1
+  $ $LHG add f2
+  $ $LHG com -m "m1"
+  $ cd ..
+
+Clone over http
+  $ $LHG serve -R r1 -d -p $HGPORT --pid-file serve.pid
+  $ $LHG --config largefiles.systemcache=$PWD/cache1 clone http://localhost:$HGPORT r2
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 2 changes to 2 files
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting changed largefiles
+  1 largefiles updated, 0 removed
+  $ ls $PWD/cache1 | diff r2/.hglf/f1 -
+  $ kill $(cat serve.pid)
+
+Clone over ssh
+  $ $LHG --config largefiles.systemcache=$PWD/cache2 clone -e "python $TESTDIR/dummyssh" --remotecmd "$LHG" ssh://user@dummy/r1 r3
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 2 changes to 2 files
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting changed largefiles
+  1 largefiles updated, 0 removed
+
+Pull tests setup
+  $ mkdir r4
+  $ cd r4
+  $ $LHG init
+  $ echo c1 > f1
+  $ $LHG add f1
+  $ $LHG com -m "m1"
+  $ echo c2 > f2
+  $ $LHG add --large f2
+  $ $LHG com -m "m2"
+  $ cd ..
+
+Pull over http
+  $ $LHG serve -R r4 -d -p $HGPORT --pid-file serve.pid
+  $ $LHG clone http://localhost:$HGPORT -r 0 r5
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd r5
+  $ $LHG pull
+  pulling from http://localhost:$HGPORT/
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  (run 'hg update' to get a working copy)
+  $ $LHG --config largefiles.systemcache=$PWD/../cache3 up
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting changed largefiles
+  1 largefiles updated, 0 removed
+  $ ls $PWD/../cache3 | diff .hglf/f2 -
+  $ cd ..
+  $ kill $(cat serve.pid)
+
+Pull over ssh
+  $ $LHG clone -e "python $TESTDIR/dummyssh" --remotecmd "$LHG" ssh://user@dummy/r4 -r 0 r6
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd r6
+  $ cat >> .hg/hgrc <<!
+  > [ui]
+  > remotecmd=$LHG
+  > ssh=python $TESTDIR/dummyssh
+  > !
+  $ $LHG pull
+  pulling from ssh://user@dummy/r4
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  (run 'hg update' to get a working copy)
+  $ $LHG --config largefiles.systemcache=$PWD/../cache4 up
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting changed largefiles
+  1 largefiles updated, 0 removed
+  $ ls $PWD/../cache4 | diff .hglf/f2 -
+  $ cd ..
+
+Push tests setup
+  $ mkdir r7
+  $ cd r7
+  $ $LHG init
+  $ echo c1 > f1
+  $ $LHG add f1
+  $ $LHG com -m "m1"
+  $ cd ..
+
+Push over http
+  $ cat >> r7/.hg/hgrc <<!
+  > [web]
+  > allow_push = *
+  > push_ssl = false
+  > !
+  $ $LHG --config largefiles.systemcache=$PWD/cache5 serve -R r7 -d -p $HGPORT --pid-file serve.pid
+  $ $LHG clone http://localhost:$HGPORT r8
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd r8
+  $ echo c2 > f2
+  $ $LHG add --large f2
+  $ $LHG com -m "m2"
+  $ $LHG push
+  pushing to http://localhost:$HGPORT/
+  searching for changes
+  searching for changes
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 1 changesets with 1 changes to 1 files
+  $ ls $PWD/../cache5 | diff .hglf/f2 -
+  $ cd ..
+  $ kill $(cat serve.pid)
+
+Push over ssh
+  $ $LHG clone -e "python $TESTDIR/dummyssh" --remotecmd "$LHG" ssh://user@dummy/r7 r9
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting changed largefiles
+  1 largefiles updated, 0 removed
+  $ cd r9
+  $ cat >> .hg/hgrc <<!
+  > [ui]
+  > remotecmd=$LHG --config largefiles.systemcache=$PWD/../cache6
+  > ssh=python $TESTDIR/dummyssh
+  > !
+  $ echo c3 > f3
+  $ $LHG add --large f3
+  $ $LHG com -m "m3"
+  $ $LHG push
+  pushing to ssh://user@dummy/r7
+  searching for changes
+  searching for changes
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 1 changesets with 1 changes to 1 files
+  $ ls $PWD/../cache6 | diff .hglf/f3 -
+  $ cd ..
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-status.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-status.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,122 @@
+#!/usr/bin/env python
+
+# Test status
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+def checkfile(file, contents):
+    hgt.asserttrue(hgt.readfile(file) == contents, 'file contents dont match')
+
+# add size and patterns for adding as a largefiles
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+os.mkdir('dir')
+os.chdir('dir')
+os.mkdir('dir')
+hgt.writefile('dir/a', 'a')
+hgt.writefile('dir/b', 'b')
+hgt.writefile('dir/c', 'c')
+hgt.writefile('dir/d', 'd')
+hgt.writefile('dir/e', 'e')
+hgt.writefile('dir/f', 'f')
+hgt.writefile('dir2/a', 'a')
+hgt.writefile('dir2/b', 'b')
+hgt.writefile('dir2/c', 'c')
+hgt.writefile('dir2/d', 'd')
+hgt.writefile('dir2/e', 'e')
+hgt.writefile('dir2/f', 'f')
+hgt.writefile('a', 'a')
+hgt.writefile('b', 'b')
+hgt.writefile('c', 'c')
+hgt.writefile('d', 'd')
+hgt.writefile('e', 'e')
+hgt.writefile('f', 'f')
+hgt.hg(['add', '--large', 'dir/b', 'dir/c', 'dir/d', 'dir/f'])
+hgt.hg(['add', 'dir2/b', 'dir2/c', 'dir2/d', 'dir2/f'])
+hgt.hg(['add', '--large', 'b', 'c', 'd', 'f'])
+hgt.hg(['commit', '-m', 'added files'])
+hgt.hg(['add', '--large', 'dir/a'])
+hgt.hg(['add', 'dir2/a'])
+hgt.hg(['add', '--large', 'a'])
+hgt.writefile('dir/b', 'bb')
+hgt.writefile('dir2/b', 'bb')
+hgt.writefile('b', 'bb')
+hgt.hg(['rm', 'dir/d'])
+hgt.hg(['rm', 'dir2/d'])
+hgt.hg(['rm', 'd'])
+os.unlink('dir/f')
+os.unlink('dir2/f')
+os.unlink('f')
+hgt.hg(['status'],
+        stdout='''M dir/b
+M dir/dir/b
+M dir/dir2/b
+A dir/a
+A dir/dir/a
+A dir/dir2/a
+R dir/d
+R dir/dir/d
+R dir/dir2/d
+! dir/dir/f
+! dir/dir2/f
+! dir/f
+? dir/dir/e
+? dir/dir2/e
+? dir/e
+''')
+hgt.hg(['status', '-A'],
+        stdout='''M dir/b
+M dir/dir/b
+M dir/dir2/b
+A dir/a
+A dir/dir/a
+A dir/dir2/a
+R dir/d
+R dir/dir/d
+R dir/dir2/d
+! dir/dir/f
+! dir/dir2/f
+! dir/f
+? dir/dir/e
+? dir/dir2/e
+? dir/e
+C dir/c
+C dir/dir/c
+C dir/dir2/c
+''')
+hgt.hg(['status', '-m'],
+        stdout='''M dir/b
+M dir/dir/b
+M dir/dir2/b
+''')
+hgt.hg(['status', '-a'],
+        stdout='''A dir/a
+A dir/dir/a
+A dir/dir2/a
+''')
+hgt.hg(['status', '-r'],
+        stdout='''R dir/d
+R dir/dir/d
+R dir/dir2/d
+''')
+hgt.hg(['status', '-d'],
+        stdout='''! dir/dir/f
+! dir/dir2/f
+! dir/f
+''')
+hgt.hg(['status', '-c'],
+        stdout='''C dir/c
+C dir/dir/c
+C dir/dir2/c
+''')
+hgt.hg(['status', '-u'],
+        stdout='''? dir/dir/e
+? dir/dir2/e
+? dir/e
+''')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-status.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-status.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,20 @@
+% setup
+hg init
+hg add --large dir/b dir/c dir/d dir/f
+hg add dir2/b dir2/c dir2/d dir2/f
+hg add --large b c d f
+hg commit -m 'added files'
+hg add --large dir/a
+hg add dir2/a
+hg add --large a
+hg rm dir/d
+hg rm dir2/d
+hg rm d
+hg status
+hg status -A
+hg status -m
+hg status -a
+hg status -r
+hg status -d
+hg status -c
+hg status -u
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-subrepos.t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-subrepos.t	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,27 @@
+Setup
+  $ export LARGEFILES='--config extensions.largefiles=$TESTDIR/..'
+  $ export LHG="hg $LARGEFILES"
+
+status on largefiles repo with subrepo
+  $ $LHG init r1
+  $ cd r1
+  $ echo c1 > f1
+  $ $LHG init sr1
+  $ cd sr1
+  $ echo c2 > f2
+  $ $LHG add f2
+  $ $LHG ci -m 'm1'
+  $ cd ..
+  $ $LHG add --large f1
+  $ cat >> .hgsub <<!
+  > sr1 = sr1
+  > !
+  $ $LHG add .hgsub
+  $ $LHG ci -m 'm2'
+  committing subrepository sr1
+  $ $LHG status
+  $ echo c1:1 > f1
+  $ echo c2:1 > sr1/f2
+  $ $LHG status -S
+  M f1
+  M sr1/f2
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-summary.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-summary.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+#
+# Test summary
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+hgt.writefile('n1', 'n1')
+hgt.writefile('b1', 'b1')
+os.mkdir('dir')
+hgt.writefile('dir/n2', 'n2')
+hgt.writefile('dir/b2', 'b2')
+hgt.hg(['add', 'n1', 'dir/n2'])
+hgt.hg(['add', '--large'],
+        stdout='''adding b1 as a largefile
+adding dir/b2 as a largefile
+''')
+hgt.hg(['commit', '-m', 'add files'])
+os.chdir('..')
+hgt.hg(['clone', 'repo1', 'repo2'],
+        stdout='''updating to branch default
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+os.chdir('repo2')
+hgt.writefile('n1', 'n11')
+hgt.writefile('b1', 'b11')
+hgt.hg(['commit', '-m', 'edit files'])
+os.chdir('..')
+
+hgt.announce('summary')
+os.chdir('repo1')
+hgt.hg(['summary'],
+        stdout='''parent: 0:eff1f304afb1 tip
+ add files
+branch: default
+commit: 2 unknown (clean)
+update: (current)
+''')
+hgt.hg(['summary', '--large'],
+        stdout='''parent: 0:eff1f304afb1 tip
+ add files
+branch: default
+commit: 2 unknown (clean)
+update: (current)
+largefiles: No remote repo
+''')
+hgt.hg(['summary', '--large', '--remote'], status=255,
+        stderr='abort: repository default not found!\n',
+        stdout='''parent: 0:eff1f304afb1 tip
+ add files
+branch: default
+commit: 2 unknown (clean)
+update: (current)
+''')
+os.chdir('../repo2')
+hgt.hg(['summary'],
+        stdout='''parent: 1:ffc34ec08c25 tip
+ edit files
+branch: default
+commit: 2 unknown (clean)
+update: (current)
+''')
+hgt.hg(['summary', '--large'],
+        stdout='''parent: 1:ffc34ec08c25 tip
+ edit files
+branch: default
+commit: 2 unknown (clean)
+update: (current)
+searching for changes
+largefiles: 1 to upload
+''')
+hgt.hg(['summary', '--large', '--remote'],
+        stdout='''parent: 1:ffc34ec08c25 tip
+ edit files
+branch: default
+commit: 2 unknown (clean)
+update: (current)
+remote: 1 outgoing
+searching for changes
+largefiles: 1 to upload
+''')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-summary.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-summary.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,15 @@
+% setup
+hg init
+hg add n1 dir/n2
+hg add --large
+hg commit -m 'add files'
+hg clone repo1 repo2
+hg commit -m 'edit files'
+
+% summary
+hg summary
+hg summary --large
+hg summary --large --remote
+hg summary
+hg summary --large
+hg summary --large --remote
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-update.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-update.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,186 @@
+#!/usr/bin/env python
+
+# Test update/update -c/update -C
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+def rejoin(path):
+    '''convert unix path to local convention'''
+    return os.path.join(*path.split('/'))
+
+def checkfiles(rev):
+    strrev = str(rev)
+    hgt.asserttrue(hgt.readfile('normal1') == 'n1' + strrev, 'files dont match')
+    hgt.asserttrue(hgt.readfile('sub/normal2') == 'n2' + strrev, 'files dont match')
+    hgt.asserttrue(hgt.readfile('sub/normal3.txt') == 'n3' + strrev, 'files dont match')
+    hgt.asserttrue(hgt.readfile('big1') == 'b1' + strrev, 'files dont match')
+    hgt.asserttrue(hgt.readfile('sub/big2') == 'b2' + strrev, 'files dont match')
+    if rev == 2:
+        hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists')
+        hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists')
+    else:
+        hgt.asserttrue(hgt.readfile('sub/big3.txt') == 'b3' + strrev, 'files dont match')
+        hgt.asserttrue(hgt.readfile('sub/normal4.txt') == 'n4' + strrev, 'files dont match')
+
+# add size and patterns for adding as largefiles
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init', '-q'])
+hgt.writefile('normal1', 'n10')
+os.mkdir('sub')
+hgt.writefile('sub/normal2', 'n20')
+hgt.writefile('sub/normal3.txt', 'n30')
+hgt.writefile('sub/normal4.txt', 'n40')
+hgt.hg(['add', 'normal1', rejoin('sub/normal2'), rejoin('sub/normal3.txt'), rejoin('sub/normal4.txt')])
+hgt.writefile('big1', 'b10')
+hgt.writefile('sub/big2', 'b20')
+hgt.writefile('sub/big3.txt', 'b30')
+hgt.hg(['add', '--large', 'big1', rejoin('sub/big2'), rejoin('sub/big3.txt')])
+hgt.hg(['commit', '-m', 'added lfiles'])
+checkfiles(0)
+
+hgt.writefile('normal1', 'n11')
+hgt.writefile('sub/normal2', 'n21')
+hgt.writefile('sub/normal3.txt', 'n31')
+hgt.writefile('sub/normal4.txt', 'n41')
+hgt.writefile('big1', 'b11')
+hgt.writefile('sub/big2', 'b21')
+hgt.writefile('sub/big3.txt', 'b31')
+hgt.hg(['commit', '-m', 'edit 1'])
+checkfiles(1)
+
+hgt.writefile('normal1', 'n12')
+hgt.writefile('sub/normal2', 'n22')
+hgt.writefile('sub/normal3.txt', 'n32')
+hgt.writefile('big1', 'b12')
+hgt.writefile('sub/big2', 'b22')
+hgt.hg(['remove', 'sub/big3.txt', 'sub/normal4.txt'])
+hgt.hg(['commit', '-m', 'edit 2 and remove'])
+checkfiles(2)
+
+hgt.writefile('normal1', 'n13')
+hgt.writefile('sub/normal2', 'n23')
+hgt.writefile('sub/normal3.txt', 'n33')
+hgt.writefile('sub/normal4.txt', 'n43')
+hgt.writefile('big1', 'b13')
+hgt.writefile('sub/big2', 'b23')
+hgt.writefile('sub/big3.txt', 'b33')
+hgt.hg(['add', 'sub/normal4.txt'])
+hgt.hg(['add', '--large', 'sub/big3.txt'])
+hgt.hg(['commit', '-m', 'edit 3 and add'])
+checkfiles(3)
+
+hgt.announce('update to revision 0 and back')
+hgt.hg(['up', '-r', '0'],
+        stdout=('7 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+checkfiles(0)
+hgt.hg(['up'],
+        stdout=('7 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+
+hgt.announce('change files and update check')
+hgt.writefile('big1', 'b14')
+hgt.hg(['up', '--check', '-r', '1'],
+            stderr='abort: uncommitted local changes\n', status=255)
+hgt.hg(['up', '-C'],
+        stdout=('0 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '1 largefiles updated, 0 removed\n'))
+checkfiles(3)
+hgt.writefile('normal1', 'n14')
+hgt.hg(['up', '-c', '-r' ,'2'],
+            stderr='abort: uncommitted local changes\n', status=255)
+hgt.hg(['up', '-C'],
+        stdout=('1 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '0 largefiles updated, 0 removed\n'))
+checkfiles(3)
+hgt.writefile('sub/big3.txt', 'tomissoooooooocool')
+hgt.hg(['up', '--check', '-r', '0'],
+            stderr='abort: uncommitted local changes\n', status=255)
+hgt.hg(['up', '-C'],
+        stdout=('0 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '1 largefiles updated, 0 removed\n'))
+checkfiles(3)
+
+hgt.announce('change files and update clean')
+hgt.writefile('big1', 'b14')
+hgt.hg(['up', '-C', '-r', '0'],
+            stdout=('7 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+checkfiles(0)
+hgt.hg(['up'],
+            stdout=('7 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+checkfiles(3)
+hgt.writefile('normal1', 'n14')
+hgt.hg(['up', '-C', '-r' ,'1'],
+            stdout=('7 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+checkfiles(1)
+hgt.hg(['up'],
+        stdout=('7 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+checkfiles(3)
+hgt.writefile('sub/big3.txt', 'tomissoooooooocool')
+hgt.hg(['up', '--clean', '-r', '2'],
+            stdout=('5 files updated, 0 files merged, 2 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '2 largefiles updated, 1 removed\n'))
+checkfiles(2)
+hgt.hg(['up'],
+        stdout=('7 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+checkfiles(3)
+
+hgt.announce('change lfile and normal update')
+hgt.writefile('sub/big2', 'WOW')
+os.mkdir('dir')
+os.chdir('dir')
+hgt.hg(['up', '-y', '-r', '0'],
+         stdout='''merging sub/big2
+largefile sub/big2 has a merge conflict
+keep (l)ocal or take (o)ther? l
+6 files updated, 1 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+os.chdir('..')
+hgt.asserttrue(hgt.readfile('normal1') == 'n10', 'files dont match')
+hgt.asserttrue(hgt.readfile('sub/normal2') == 'n20', 'files dont match')
+hgt.asserttrue(hgt.readfile('sub/normal3.txt') == 'n30', 'files dont match')
+hgt.asserttrue(hgt.readfile('sub/normal4.txt') == 'n40', 'files dont match')
+hgt.asserttrue(hgt.readfile('big1') == 'b10', 'files dont match')
+hgt.asserttrue(hgt.readfile('sub/big2') == 'WOW', 'files dont match')
+hgt.asserttrue(hgt.readfile('sub/big3.txt') == 'b30', 'files dont match')
+os.chdir('dir')
+hgt.hg(['up', '--clean'],
+         stdout=('7 files updated, 0 files merged, 0 files removed, 0 files unresolved\n'
+                'getting changed largefiles\n'
+                '3 largefiles updated, 0 removed\n'))
+os.chdir('..')
+checkfiles(3)
+hgt.writefile('big1', 'b12')
+hgt.writefile('normal1', 'n12')
+os.chdir('dir')
+hgt.hg(['up', '-y', '-r', '2'],
+         stdout='''5 files updated, 0 files merged, 2 files removed, 0 files unresolved
+getting changed largefiles
+1 largefiles updated, 1 removed
+''')
+os.chdir('..')
+checkfiles(2)
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-update.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-update.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,36 @@
+% setup
+hg init -q
+hg add normal1 sub/normal2 sub/normal3.txt sub/normal4.txt
+hg add --large big1 sub/big2 sub/big3.txt
+hg commit -m 'added lfiles'
+hg commit -m 'edit 1'
+hg remove sub/big3.txt sub/normal4.txt
+hg commit -m 'edit 2 and remove'
+hg add sub/normal4.txt
+hg add --large sub/big3.txt
+hg commit -m 'edit 3 and add'
+
+% update to revision 0 and back
+hg up -r 0
+hg up
+
+% change files and update check
+hg up --check -r 1
+hg up -C
+hg up -c -r 2
+hg up -C
+hg up --check -r 0
+hg up -C
+
+% change files and update clean
+hg up -C -r 0
+hg up
+hg up -C -r 1
+hg up
+hg up --clean -r 2
+hg up
+
+% change lfile and normal update
+hg up -y -r 0
+hg up --clean
+hg up -y -r 2
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-verify.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-verify.py	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+#
+# Test verify
+
+import os
+import common
+
+hgt = common.LfilesTester()
+
+hgt.updaterc()
+hgt.announce('setup')
+os.mkdir('repo1')
+os.chdir('repo1')
+hgt.hg(['init'])
+hgt.writefile('n1', 'n1')
+hgt.writefile('b1', 'b1')
+os.mkdir('dir')
+hgt.writefile('dir/n2', 'n2')
+hgt.writefile('dir/b2', 'b2')
+hgt.hg(['add', 'n1', 'dir/n2'])
+hgt.hg(['add', '--large'],
+        stdout='''adding b1 as a largefile
+adding dir/b2 as a largefile
+''')
+hgt.hg(['commit', '-m', 'add files'])
+os.chdir('..')
+hgt.hg(['clone', 'repo1', 'repo2'],
+        stdout='''updating to branch default
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+getting changed largefiles
+2 largefiles updated, 0 removed
+''')
+os.chdir('repo2')
+hgt.writefile('n1', 'n11')
+hgt.writefile('b1', 'b11')
+hgt.hg(['commit', '-m', 'edit files'])
+os.chdir('..')
+
+hgt.announce('verify')
+os.chdir('repo1')
+hgt.hg(['verify', '--large'],
+        stdout='''checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+4 files, 1 changesets, 4 total revisions
+searching 1 changesets for largefiles
+verified existence of 2 revisions of 2 largefiles
+''')
+os.chdir('../repo2')
+hgt.hg(['verify', '--large'],
+        stdout='''checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+4 files, 2 changesets, 6 total revisions
+searching 1 changesets for largefiles
+verified existence of 2 revisions of 2 largefiles
+''')
+hgt.hg(['push', '../repo1'],
+        stdout='''pushing to ../repo1
+searching for changes
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 2 changes to 2 files
+''')
+hgt.hg(['verify', '--large', '--lfa'],
+        stdout='''checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+4 files, 2 changesets, 6 total revisions
+searching 2 changesets for largefiles
+verified existence of 3 revisions of 2 largefiles
+''')
+hgt.hg(['verify', '--large', '--lfc', '--lfa'],
+    stdout='''checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+4 files, 2 changesets, 6 total revisions
+searching 2 changesets for largefiles
+verified contents of 3 revisions of 2 largefiles
+''')
+os.chdir('../repo1')
+hgt.hg(['verify', '--large', '--lfc'],
+        stdout='''checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+4 files, 2 changesets, 6 total revisions
+searching 1 changesets for largefiles
+verified contents of 2 revisions of 2 largefiles
+''')
+hgt.hg(['verify', '--large', '--lfc', '--lfa'],
+        stdout='''checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+4 files, 2 changesets, 6 total revisions
+searching 2 changesets for largefiles
+verified contents of 3 revisions of 2 largefiles
+''')
diff -r fee6dc9ed4e6 -r a3d92a9d56d5 hgext/largefiles/tests/test-verify.py.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/largefiles/tests/test-verify.py.out	Sat Sep 24 17:36:31 2011 +0200
@@ -0,0 +1,16 @@
+% setup
+hg init
+hg add n1 dir/n2
+hg add --large
+hg commit -m 'add files'
+hg clone repo1 repo2
+hg commit -m 'edit files'
+
+% verify
+hg verify --large
+hg verify --large
+hg push ../repo1
+hg verify --large --lfa
+hg verify --large --lfc --lfa
+hg verify --large --lfc
+hg verify --large --lfc --lfa


More information about the Mercurial-devel mailing list