Re: merging into a read only file succeeds

2022-02-24 Thread Mark Phippard
On Thu, Feb 24, 2022 at 10:51 AM Lorenz  wrote:

> just discovered, that merging into a RO file succeeds.
> I my case the file is RO because of a needs-lock property.
> So when I try to commit I can't.
>
> This effect ist at least annoying.
> There is a reason why the file is read only.

It is interesting both that it was able to do this and also that this
has never come up before. I am not sure I can wrap my head around what
I think should even happen here. There is no way you could be expected
to obtain locks on these files before merging. I guess ideally merge
would obtain locks but I just do not know what merge should do if it
cannot obtain the lock. I guess it should behave the same way it would
if the file was not present due to it being a sparse working copy.

Maybe merge should just refuse to run at all if it detects any
svn:needs-lock properties in the WC?

It is a hard problem to solve.

Mark


Re: merging into a read only file succeeds

2022-02-24 Thread Nathan Hartman
On Thu, Feb 24, 2022 at 2:33 PM Mark Phippard  wrote:
>
> On Thu, Feb 24, 2022 at 10:51 AM Lorenz  wrote:
>
> > just discovered, that merging into a RO file succeeds.
> > I my case the file is RO because of a needs-lock property.
> > So when I try to commit I can't.
> >
> > This effect ist at least annoying.
> > There is a reason why the file is read only.
>
> It is interesting both that it was able to do this and also that this
> has never come up before. I am not sure I can wrap my head around what
> I think should even happen here. There is no way you could be expected
> to obtain locks on these files before merging. I guess ideally merge
> would obtain locks but I just do not know what merge should do if it
> cannot obtain the lock. I guess it should behave the same way it would
> if the file was not present due to it being a sparse working copy.

Hopefully there would be a visible warning if that happened!

> Maybe merge should just refuse to run at all if it detects any
> svn:needs-lock properties in the WC?

Then it would never be able to run; I think you meant: refuse to run
if we don't hold the lock on a file that has the svn:needs-lock
property. However, it would be rather irritating if the refusal to run
were caused by files unaffected by the merge. Whether that is more or
less annoying than merging to the read-only file is up to
interpretation.

> It is a hard problem to solve.

I suggest to file an issue for now.

Also, perhaps a workaround exists, or at least a way for users to
check whether they should obtain locks before running a merge,
preferably one that uses existing SVN commands. Some combination of
'svn merge --dry-run' and 'svn status -u', or something along those
lines?

Nathan