Submitter | Hannes Oldenburg |
---|---|
Date | July 23, 2016, 7:44 a.m. |
Message ID | <0895bddd5f226d8c5c70.1469259866@localhost.localdomain> |
Download | mbox | patch |
Permalink | /patch/15974/ |
State | Accepted |
Headers | show |
Comments
Woah sorry typo from previous version is still in it. s/wich/which/ On Sat, Jul 23, 2016 at 9:44 AM, Hannes Oldenburg < hannes.christian.oldenburg@gmail.com> wrote: > # HG changeset patch > # User Hannes Oldenburg hannes.christian.oldenburg@gmail.com > # Date 1469186982 0 > # Fri Jul 22 11:29:42 2016 +0000 > # Branch stable > # Node ID 0895bddd5f226d8c5c70cb31a60355bda768a384 > # Parent d3df009ab1175a6792549b51ae66486dd98f398b > cmdutil: warnings not issued in remove if subrepopath overlaps > > Previously a subrepository "sub" would cause no warnings to be issued > for a file "subnot/a" if it is not removed when calling: > > hg remove -S "subnot/a" > > diff -r d3df009ab117 -r 0895bddd5f22 mercurial/cmdutil.py > --- a/mercurial/cmdutil.py Wed Jul 20 14:12:45 2016 -0500 > +++ b/mercurial/cmdutil.py Fri Jul 22 11:29:42 2016 +0000 > @@ -2481,14 +2481,15 @@ > for f in files: > def insubrepo(): > for subpath in wctx.substate: > - if f.startswith(subpath): > + if f.startswith(subpath + '/'): > return True > return False > > count += 1 > ui.progress(_('deleting'), count, total=total, unit=_('files')) > isdir = f in deleteddirs or wctx.hasdir(f) > - if f in repo.dirstate or isdir or f == '.' or insubrepo(): > + if (f in repo.dirstate or isdir or f == '.' > + or insubrepo() or f in subs): > continue > > if repo.wvfs.exists(f): > diff -r d3df009ab117 -r 0895bddd5f22 tests/test-subrepo.t > --- a/tests/test-subrepo.t Wed Jul 20 14:12:45 2016 -0500 > +++ b/tests/test-subrepo.t Fri Jul 22 11:29:42 2016 +0000 > @@ -53,6 +53,15 @@ > 7cf8cfea66e410e8e3336508dfeec07b3192de51 > .hgsub .hgsubstate > > +Subrepopath wich overlaps with filepath, does not change warnings in > remove() > + > + $ mkdir snot > + $ touch snot/file > + $ hg remove -S snot/file > + not removing snot/file: file is untracked > + [1] > + $ rm -r snot > + > Revert subrepo and test subrepo fileset keyword: > > $ echo b > s/a >
On Sat, 23 Jul 2016 07:44:26 +0000, Hannes Oldenburg wrote: > # HG changeset patch > # User Hannes Oldenburg hannes.christian.oldenburg@gmail.com Strange user name syntax. Fixed as "Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>" > # Date 1469186982 0 > # Fri Jul 22 11:29:42 2016 +0000 > # Branch stable > # Node ID 0895bddd5f226d8c5c70cb31a60355bda768a384 > # Parent d3df009ab1175a6792549b51ae66486dd98f398b > cmdutil: warnings not issued in remove if subrepopath overlaps Queued this, thanks.
Patch
diff -r d3df009ab117 -r 0895bddd5f22 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Wed Jul 20 14:12:45 2016 -0500 +++ b/mercurial/cmdutil.py Fri Jul 22 11:29:42 2016 +0000 @@ -2481,14 +2481,15 @@ for f in files: def insubrepo(): for subpath in wctx.substate: - if f.startswith(subpath): + if f.startswith(subpath + '/'): return True return False count += 1 ui.progress(_('deleting'), count, total=total, unit=_('files')) isdir = f in deleteddirs or wctx.hasdir(f) - if f in repo.dirstate or isdir or f == '.' or insubrepo(): + if (f in repo.dirstate or isdir or f == '.' + or insubrepo() or f in subs): continue if repo.wvfs.exists(f): diff -r d3df009ab117 -r 0895bddd5f22 tests/test-subrepo.t --- a/tests/test-subrepo.t Wed Jul 20 14:12:45 2016 -0500 +++ b/tests/test-subrepo.t Fri Jul 22 11:29:42 2016 +0000 @@ -53,6 +53,15 @@ 7cf8cfea66e410e8e3336508dfeec07b3192de51 .hgsub .hgsubstate +Subrepopath wich overlaps with filepath, does not change warnings in remove() + + $ mkdir snot + $ touch snot/file + $ hg remove -S snot/file + not removing snot/file: file is untracked + [1] + $ rm -r snot + Revert subrepo and test subrepo fileset keyword: $ echo b > s/a