Patchwork [3,of,8] localrepo: ignore always-empty 'unknown' files when looking for '.hgtags'

login
register
mail settings
Submitter Martin von Zweigbergk
Date Oct. 2, 2014, 12:01 a.m.
Message ID <e1154b545f8411371124.1412208115@handduk2.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6073/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Oct. 2, 2014, 12:01 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@gmail.com>
# Date 1412196063 25200
#      Wed Oct 01 13:41:03 2014 -0700
# Node ID e1154b545f8411371124e7c24fd7e3f67c11dcba
# Parent  82b9c894095a9d739c25c42951ed1c7788b5ad90
localrepo: ignore always-empty 'unknown' files when looking for '.hgtags'

Since the call to self.status() does not request listing of unknown
files, that list will always be empty. Still, the lists of files
searched for '.hgtags' includes that list, but not the ignored and
clean files, which will also always be empty. This seems misleading,
so let's ignore the unknown files as well.
Matt Mackall - Oct. 2, 2014, 11:41 p.m.
On Wed, 2014-10-01 at 17:01 -0700, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@gmail.com>
> # Date 1412196063 25200
> #      Wed Oct 01 13:41:03 2014 -0700
> # Node ID e1154b545f8411371124e7c24fd7e3f67c11dcba
> # Parent  82b9c894095a9d739c25c42951ed1c7788b5ad90
> localrepo: ignore always-empty 'unknown' files when looking for '.hgtags'
> 
> Since the call to self.status() does not request listing of unknown
> files, that list will always be empty. Still, the lists of files
> searched for '.hgtags' includes that list, but not the ignored and
> clean files, which will also always be empty. This seems misleading,
> so let's ignore the unknown files as well.

The semantics here changed as a side effect when I changed the default
args to status in 2008:

http://www.selenic.com/hg/diff/4faaa0535ea7/mercurial/localrepo.py

..but I don't think your suggested change is actually correct: if we
have a non-tracked .hgtags, we don't want to blindly append to it and
commit it because we'll be introducing more that our tag in the commit.

I'll clean this up.
Martin von Zweigbergk - Oct. 2, 2014, 11:54 p.m.
On Thu, Oct 2, 2014 at 4:41 PM, Matt Mackall <mpm@selenic.com> wrote:
> On Wed, 2014-10-01 at 17:01 -0700, Martin von Zweigbergk wrote:
>> # HG changeset patch
>> # User Martin von Zweigbergk <martinvonz@gmail.com>
>> # Date 1412196063 25200
>> #      Wed Oct 01 13:41:03 2014 -0700
>> # Node ID e1154b545f8411371124e7c24fd7e3f67c11dcba
>> # Parent  82b9c894095a9d739c25c42951ed1c7788b5ad90
>> localrepo: ignore always-empty 'unknown' files when looking for '.hgtags'
>>
>> Since the call to self.status() does not request listing of unknown
>> files, that list will always be empty. Still, the lists of files
>> searched for '.hgtags' includes that list, but not the ignored and
>> clean files, which will also always be empty. This seems misleading,
>> so let's ignore the unknown files as well.
>
> The semantics here changed as a side effect when I changed the default
> args to status in 2008:
>
> http://www.selenic.com/hg/diff/4faaa0535ea7/mercurial/localrepo.py
>
> ..but I don't think your suggested change is actually correct: if we
> have a non-tracked .hgtags, we don't want to blindly append to it and
> commit it because we'll be introducing more that our tag in the commit.

Ah, I see. That makes sense.

> I'll clean this up.

Thanks!
Matt Mackall - Oct. 2, 2014, 11:58 p.m.
On Thu, 2014-10-02 at 16:54 -0700, Martin von Zweigbergk wrote:
> On Thu, Oct 2, 2014 at 4:41 PM, Matt Mackall <mpm@selenic.com> wrote:
> > On Wed, 2014-10-01 at 17:01 -0700, Martin von Zweigbergk wrote:
> >> # HG changeset patch
> >> # User Martin von Zweigbergk <martinvonz@gmail.com>
> >> # Date 1412196063 25200
> >> #      Wed Oct 01 13:41:03 2014 -0700
> >> # Node ID e1154b545f8411371124e7c24fd7e3f67c11dcba
> >> # Parent  82b9c894095a9d739c25c42951ed1c7788b5ad90
> >> localrepo: ignore always-empty 'unknown' files when looking for '.hgtags'
> >>
> >> Since the call to self.status() does not request listing of unknown
> >> files, that list will always be empty. Still, the lists of files
> >> searched for '.hgtags' includes that list, but not the ignored and
> >> clean files, which will also always be empty. This seems misleading,
> >> so let's ignore the unknown files as well.
> >
> > The semantics here changed as a side effect when I changed the default
> > args to status in 2008:
> >
> > http://www.selenic.com/hg/diff/4faaa0535ea7/mercurial/localrepo.py
> >
> > ..but I don't think your suggested change is actually correct: if we
> > have a non-tracked .hgtags, we don't want to blindly append to it and
> > commit it because we'll be introducing more that our tag in the commit.
> 
> Ah, I see. That makes sense.
> 
> > I'll clean this up.
> 
> Thanks!

FYI, the cleanup ended up looking exactly like the test you also touched
in gpg.py.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -574,7 +574,7 @@ 
         date: date tuple to use if committing'''
 
         if not local:
-            for x in self.status()[:5]:
+            for x in self.status()[:4]:
                 if '.hgtags' in x:
                     raise util.Abort(_('working copy of .hgtags is changed '
                                        '(please commit .hgtags manually)'))