# HG changeset patch # User Matt Mackall # Date 1343151400 18000 # Node ID ffc49100151b68c0bcd061b900d9993e9e1a0d7d # Parent 57a47190e96cf4e0959e9d43a74f858ca79b9da1# Parent 848a1c1e51cd7d4475c372cb7461c8f9a24a8401 merge with i18n diff -r 848a1c1e51cd -r ffc49100151b hgext/largefiles/__init__.py --- a/hgext/largefiles/__init__.py Mon Jul 23 20:38:33 2012 +0200 +++ b/hgext/largefiles/__init__.py Tue Jul 24 12:36:40 2012 -0500 @@ -92,6 +92,8 @@ import reposetup import uisetup +testedwith = 'internal' + reposetup = reposetup.reposetup uisetup = uisetup.uisetup diff -r 848a1c1e51cd -r ffc49100151b hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Mon Jul 23 20:38:33 2012 +0200 +++ b/hgext/largefiles/overrides.py Tue Jul 24 12:36:40 2012 -0500 @@ -81,9 +81,16 @@ ui.warn(_('%s already a largefile\n') % f) continue - if exact or not exists: + if (exact or not exists) and not lfutil.isstandin(f): + wfile = repo.wjoin(f) + + # In case the file was removed previously, but not committed + # (issue3507) + if not os.path.exists(wfile): + continue + abovemin = (lfsize and - os.lstat(repo.wjoin(f)).st_size >= lfsize * 1024 * 1024) + os.lstat(wfile).st_size >= lfsize * 1024 * 1024) if large or abovemin or (lfmatcher and lfmatcher(f)): lfnames.append(f) if ui.verbose or not exact: @@ -1001,8 +1008,9 @@ # we don't remove the standin in the largefiles code, preventing a very # confused state later. if missing: + m = [repo.wjoin(f) for f in missing] repo._isaddremove = True - removelargefiles(ui, repo, *missing, **opts) + removelargefiles(ui, repo, *m, **opts) repo._isaddremove = False # Call into the normal add code, and any files that *should* be added as # largefiles will be diff -r 848a1c1e51cd -r ffc49100151b hgext/largefiles/reposetup.py --- a/hgext/largefiles/reposetup.py Mon Jul 23 20:38:33 2012 +0200 +++ b/hgext/largefiles/reposetup.py Tue Jul 24 12:36:40 2012 -0500 @@ -338,15 +338,18 @@ lfutil.updatestandin(self, lfutil.standin(lfile)) lfdirstate.normal(lfile) - for lfile in lfdirstate: - if lfile in modifiedfiles: - if (not os.path.exists(repo.wjoin( - lfutil.standin(lfile)))) or \ - (not os.path.exists(repo.wjoin(lfile))): - lfdirstate.drop(lfile) result = orig(text=text, user=user, date=date, match=match, force=force, editor=editor, extra=extra) + + if result is not None: + for lfile in lfdirstate: + if lfile in modifiedfiles: + if (not os.path.exists(repo.wjoin( + lfutil.standin(lfile)))) or \ + (not os.path.exists(repo.wjoin(lfile))): + lfdirstate.drop(lfile) + # This needs to be after commit; otherwise precommit hooks # get the wrong status lfdirstate.write() diff -r 848a1c1e51cd -r ffc49100151b mercurial/encoding.py --- a/mercurial/encoding.py Mon Jul 23 20:38:33 2012 +0200 +++ b/mercurial/encoding.py Tue Jul 24 12:36:40 2012 -0500 @@ -168,8 +168,9 @@ def lower(s): "best-effort encoding-aware case-folding of local string s" try: - return s.encode('ascii').lower() - except UnicodeError: + s.decode('ascii') # throw exception for non-ASCII character + return s.lower() + except UnicodeDecodeError: pass try: if isinstance(s, localstr): @@ -189,6 +190,11 @@ def upper(s): "best-effort encoding-aware case-folding of local string s" try: + s.decode('ascii') # throw exception for non-ASCII character + return s.upper() + except UnicodeDecodeError: + pass + try: if isinstance(s, localstr): u = s._utf8.decode("utf-8") else: diff -r 848a1c1e51cd -r ffc49100151b mercurial/util.py --- a/mercurial/util.py Mon Jul 23 20:38:33 2012 +0200 +++ b/mercurial/util.py Tue Jul 24 12:36:40 2012 -0500 @@ -816,6 +816,8 @@ # delegated methods self.write = self._fp.write + self.seek = self._fp.seek + self.tell = self._fp.tell self.fileno = self._fp.fileno def close(self): diff -r 848a1c1e51cd -r ffc49100151b tests/test-largefiles.t --- a/tests/test-largefiles.t Mon Jul 23 20:38:33 2012 +0200 +++ b/tests/test-largefiles.t Tue Jul 24 12:36:40 2012 -0500 @@ -370,6 +370,146 @@ removing normal3 adding normaladdremove +Test addremove with -R + + $ hg up -C + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + getting changed largefiles + 1 largefiles updated, 0 removed + $ rm normal3 + $ rm sub/large4 + $ echo "testing addremove with patterns" > testaddremove.dat + $ echo "normaladdremove" > normaladdremove + $ cd .. + $ hg -R a addremove + removing sub/large4 + adding a/testaddremove.dat as a largefile (glob) + removing normal3 + adding normaladdremove + $ cd a + +Test 3364 + $ hg clone . ../addrm + updating to branch default + 5 files updated, 0 files merged, 0 files removed, 0 files unresolved + getting changed largefiles + 3 largefiles updated, 0 removed + $ cd ../addrm + $ cat >> .hg/hgrc < [hooks] + > post-commit.stat=sh -c "echo \"Invoking status postcommit hook\"; hg status -A" + > EOF + $ touch foo + $ hg add --large foo + $ hg ci -m "add foo" + Invoking status precommit hook + A foo + Invoking status postcommit hook + C foo + C normal3 + C sub/large4 + C sub/normal4 + C sub2/large6 + C sub2/large7 + $ rm foo + $ hg st + ! foo +hmm.. no precommit invoked, but there is a postcommit?? + $ hg ci -m "will not checkin" + nothing changed + Invoking status postcommit hook + ! foo + C normal3 + C sub/large4 + C sub/normal4 + C sub2/large6 + C sub2/large7 + [1] + $ hg addremove + removing foo + $ hg st + R foo + $ hg ci -m "used to say nothing changed" + Invoking status precommit hook + R foo + Invoking status postcommit hook + C normal3 + C sub/large4 + C sub/normal4 + C sub2/large6 + C sub2/large7 + $ hg st + +Test 3507 (both normal files and largefiles were a problem) + + $ touch normal + $ touch large + $ hg add normal + $ hg add --large large + $ hg ci -m "added" + Invoking status precommit hook + A large + A normal + Invoking status postcommit hook + C large + C normal + C normal3 + C sub/large4 + C sub/normal4 + C sub2/large6 + C sub2/large7 + $ hg remove normal + $ hg addremove --traceback + $ hg ci -m "addremoved normal" + Invoking status precommit hook + R normal + Invoking status postcommit hook + C large + C normal3 + C sub/large4 + C sub/normal4 + C sub2/large6 + C sub2/large7 + $ hg up -C '.^' + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + getting changed largefiles + 0 largefiles updated, 0 removed + $ hg remove large + $ hg addremove --traceback + $ hg ci -m "removed large" + Invoking status precommit hook + R large + created new head + Invoking status postcommit hook + C normal + C normal3 + C sub/large4 + C sub/normal4 + C sub2/large6 + C sub2/large7 + +Test that a standin can't be added as a large file + + $ touch large + $ hg add --large large + $ hg ci -m "add" + Invoking status precommit hook + A large + Invoking status postcommit hook + C large + C normal + C normal3 + C sub/large4 + C sub/normal4 + C sub2/large6 + C sub2/large7 + $ hg remove large + $ touch large + $ hg addremove --config largefiles.patterns=**large --traceback + adding large as a largefile + + $ cd ../a + Clone a largefiles repo. $ hg clone . ../b @@ -988,7 +1128,8 @@ $ cd .. putlfile errors are shown (issue3123) -Corrupt the cached largefile in r7 +Corrupt the cached largefile in r7 and in the usercache (required for testing on vfat) + $ echo corruption > "$TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8" $ echo corruption > "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8" $ hg init empty $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \