# HG changeset patch # User Matt Mackall # Date 1332798173 18000 # Node ID e53c0b2d7b6081586666579b4d0a2ffdedaac1b8 # Parent 2b0a406d3043b0895b0267a9616b5e65ea33f952# Parent 6c4dbe28dda39cc3866d4e0e22bb1af0d1d3e94a merge with stable diff -r 2b0a406d3043 -r e53c0b2d7b60 hgext/largefiles/reposetup.py --- a/hgext/largefiles/reposetup.py Mon Mar 26 16:41:54 2012 -0500 +++ b/hgext/largefiles/reposetup.py Mon Mar 26 16:42:53 2012 -0500 @@ -137,8 +137,11 @@ # Create a copy of match that matches standins instead # of largefiles. def tostandin(file): - if inctx(lfutil.standin(file), ctx2): - return lfutil.standin(file) + if working: + sf = lfutil.standin(file) + dirstate = repo.dirstate + if sf in dirstate or sf in dirstate.dirs(): + return sf return file # Create a function that we can use to override what is @@ -167,8 +170,12 @@ origignore = lfdirstate._ignore lfdirstate._ignore = _ignoreoverride - match._files = [f for f in match._files if f in - lfdirstate] + def sfindirstate(f): + sf = lfutil.standin(f) + dirstate = repo.dirstate + return sf in dirstate or sf in dirstate.dirs() + match._files = [f for f in match._files + if sfindirstate(f)] # Don't waste time getting the ignored and unknown # files again; we already have them s = lfdirstate.status(match, [], False, diff -r 2b0a406d3043 -r e53c0b2d7b60 hgext/rebase.py --- a/hgext/rebase.py Mon Mar 26 16:41:54 2012 -0500 +++ b/hgext/rebase.py Mon Mar 26 16:42:53 2012 -0500 @@ -557,15 +557,18 @@ def abort(repo, originalwd, target, state): 'Restore the repository to its original state' - descendants = repo.changelog.descendants - ispublic = lambda r: repo._phaserev[r] == phases.public - if filter(ispublic, descendants(target)): + dstates = [s for s in state.values() if s != nullrev] + if [d for d in dstates if not repo[d].mutable()]: repo.ui.warn(_("warning: immutable rebased changeset detected, " "can't abort\n")) return -1 - elif set(descendants(target)) - set(state.values()): + + descendants = set() + if dstates: + descendants = set(repo.changelog.descendants(*dstates)) + if descendants - set(dstates): repo.ui.warn(_("warning: new changesets detected on target branch, " - "can't abort\n")) + "can't abort\n")) return -1 else: # Strip from the first rebased revision diff -r 2b0a406d3043 -r e53c0b2d7b60 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Mon Mar 26 16:41:54 2012 -0500 +++ b/mercurial/cmdutil.py Mon Mar 26 16:42:53 2012 -0500 @@ -285,6 +285,16 @@ # check for overwrites exists = os.path.lexists(target) + samefile = False + if exists and abssrc != abstarget: + if (repo.dirstate.normalize(abssrc) == + repo.dirstate.normalize(abstarget)): + if not rename: + ui.warn(_("%s: can't copy - same file\n") % reltarget) + return + exists = False + samefile = True + if not after and exists or after and state in 'mn': if not opts['force']: ui.warn(_('%s: not overwriting - file exists\n') % @@ -307,7 +317,12 @@ targetdir = os.path.dirname(target) or '.' if not os.path.isdir(targetdir): os.makedirs(targetdir) - util.copyfile(src, target) + if samefile: + tmp = target + "~hgrename" + os.rename(src, tmp) + os.rename(tmp, target) + else: + util.copyfile(src, target) srcexists = True except IOError, inst: if inst.errno == errno.ENOENT: @@ -330,7 +345,7 @@ scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget, dryrun=dryrun, cwd=cwd) if rename and not dryrun: - if not after and srcexists: + if not after and srcexists and not samefile: util.unlinkpath(repo.wjoin(abssrc)) wctx.forget([abssrc]) diff -r 2b0a406d3043 -r e53c0b2d7b60 tests/test-largefiles.t --- a/tests/test-largefiles.t Mon Mar 26 16:41:54 2012 -0500 +++ b/tests/test-largefiles.t Mon Mar 26 16:42:53 2012 -0500 @@ -68,6 +68,8 @@ Remove both largefiles and normal files. $ hg remove normal1 large1 + $ hg status large1 + R large1 $ hg commit -m "remove files" Invoking status precommit hook R large1 @@ -249,6 +251,13 @@ A sub2/large6 A sub2/large7 +Test "hg status" with combination of 'file pattern' and 'directory +pattern' for largefiles: + + $ hg status sub2/large6 sub2 + A sub2/large6 + A sub2/large7 + Config settings (pattern **.dat, minsize 2 MB) are respected. $ echo testdata > test.dat