# HG changeset patch # User Matt Mackall # Date 2012-03-26 21:42:53 # Node ID e53c0b2d7b6081586666579b4d0a2ffdedaac1b8 # Parent 2b0a406d3043b0895b0267a9616b5e65ea33f952 # Parent 6c4dbe28dda39cc3866d4e0e22bb1af0d1d3e94a merge with stable diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py --- a/hgext/largefiles/reposetup.py +++ b/hgext/largefiles/reposetup.py @@ -137,8 +137,11 @@ def reposetup(ui, repo): # 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 @@ def reposetup(ui, repo): 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 --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -557,15 +557,18 @@ def restorestatus(repo): 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 --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -285,6 +285,16 @@ def copy(ui, repo, pats, opts, rename=Fa # 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 @@ def copy(ui, repo, pats, opts, rename=Fa 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 @@ def copy(ui, repo, pats, opts, rename=Fa 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 --git a/tests/test-largefiles.t b/tests/test-largefiles.t --- a/tests/test-largefiles.t +++ b/tests/test-largefiles.t @@ -68,6 +68,8 @@ Commit preserved largefile contents. 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 @@ Corner cases for adding largefiles. 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