Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-05 Thread Gilles

On 05/08/2018 05:47, Warren Young wrote:
It is not correct to say that Fossil had no output in this case. Its 
output was the exit status code, which was zero, meaning there was no 
failure.
I understand that it's too late now that some scripts would break if 
diff/gdiff returned something like "No change" instead of remaining 
mute, but I think it would have been helpful to output some information 
so that the user know it's not some issue with an external differ like 
we all thought.


Back to real life.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Warren Young
On Aug 4, 2018, at 12:13 PM, Gilles  wrote:
> 
> But then, "fossil changes" returns nothing either, and it's coherent with the 
> Unix philosophy.

Precisely.  You’re applying Windows mores to a tool that comes out of the Unix 
tradition.  As long as you do that, you’ll have expectation mismatches.

It is not correct to say that Fossil had no output in this case.  Its output 
was the exit status code, which was zero, meaning there was no failure.  Since 
there is also no standard output, that means there are no differences.  You can 
check for this combination in a POSIX shell:

diffs=$(fossil diff)
if [ $? = 0 ]
then
echo No difference found.
elif [ -n "$diffs" ]
then
echo Difference found.
else
echo Program exit failure, code $?.
fi

If you know the history of mathematics, you know what kind of contortions they 
had to go through before they invented the concept of zero.  This is analogous.

If we relied instead on text output to signal “No changes,” it would break if 
Fossil was ever localized:

if fossil diff | grep -q 'No changes'
then
… do something for the change case …
else
… do something else for the no-change case …
fi

You’d erroneously end up in the no-change case because the output would be 
“Aucun changement” on an OS configured for a French locale, if Fossil ever gets 
localized for French.

If you doubt the usefulness of such a script, consider a “make release” script, 
which first checks whether there are any changes to unexpected files before 
proceeding.  In one of my projects, the only expected changes upon creating a 
release are a new section in the ChangeLog.md file and a single-line change to 
the VERSION variable within the Makefile; anything else means you’ve probably 
forgotten to check something in separately first.  The above shell script logic 
allows us to test for things like this and stop the process if pilot error is 
suspected.

If I’ve yet to convince you that this design philosophy is sensible, consider 
that it’s one of several reasons why Unix type systems are far more easily 
scripted than Windows systems, which in turn is one of the largest reasons 
they’ve taken over the cloud space.  You can’t deploy 1000 Windows instances at 
peak load every day and tear them back down as the load decreases when you 
cannot easily and reliably script the process.

I speak from experience.  One of my current Windows software projects drives a 
program that is externally scriptable only by programming to its .NET API.  If 
this program were available on Linux and followed its conventions, I’d expect 
to be able to replace the .NET code and its attendant MSI deployment mess with 
a far simpler shell script.  I’ve probably spent more time getting the MSI 
creator working than I’d have spent writing that shell script.

Incidentally, I asked you for “fossil stat” output in part because I 
anticipated this possibility: it didn’t give you an “EDITED” line for these 
files you’ve been checking for changes.  You will come to notice absences like 
that.  It will be a clue that you either have no changes or that you forgot to 
add a new file to the repository, so Fossil is still ignoring it.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Gilles

On 04/08/2018 18:19, Stephan Beal wrote:
Outputting "no differences" to stdout would (IMO) be fine if 
automation had the option to use --quiet to surprise that.
Considering no one thought about this before I mentioned that "fossil 
diff" also returned nothing… it looks like it might not be that bad an 
idea to tell the user that an empty result simply means that no change 
was detected between the workspace file and the last revision in the 
repo. No reason to worry about the settings, short/long filenames, 
forward and backward slashes, etc.


But then, "fossil changes" returns nothing either, and it's coherent 
with the Unix philosophy.


Bah, it's a hot Saturday in the Northern hemisphere, we didn't spend 
that much time on the issue, and today's exchange should hopefully be 
reachable through Google for other users' benefit. Science!
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Martin Gagnon
Le sam. 4 août 2018 à 11:17, Stephan Beal  a écrit :

> If it was that common we would have realized the problem sooner ;).
>
> The problem with generating output for "no changes" is that we potentially
> break any automation which relies on an empty diff to mean "no changes".
>

That is what stderr is for.

—
Martin G.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Stephan Beal
If it was that common we would have realized the problem sooner ;).

The problem with generating output for "no changes" is that we potentially
break any automation which relies on an empty diff to mean "no changes".
(That lnly applies to "diff", not gdiff.) That could, i guess, be "fixed"
by adding a --quiet option, suppressing any non-diff output. Something to
consider, in any case.

- stephan
Sent from a mobile device, possibly left-handed from bed. Please excuse
brevity, typos, and top-posting.

On Sat, Aug 4, 2018, 17:11 Gilles  wrote:

> On 04/08/2018 16:43, Stephan Beal wrote:
>
> That means there are no diffs to show. Try:
>
> fossil gdiff --from prev test.html
>
> That was it.
>
> Grrr, I should have thought about it :-/
>
> I don't know how common this mistake is, but if it, it might be a good
> thing if Fossil said something like "No change."
>
> Thanks much everyone.
> ___
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Gilles

On 04/08/2018 16:43, Stephan Beal wrote:

That means there are no diffs to show. Try:

fossil gdiff --from prev test.html

That was it.

Grrr, I should have thought about it :-/

I don't know how common this mistake is, but if it, it might be a good 
thing if Fossil said something like "No change."


Thanks much everyone.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Stephan Beal
On Sat, Aug 4, 2018 at 4:25 PM Gilles  wrote:

> On 04/08/2018 15:51, Gilles wrote:
> > d:\Temp>fossil gdiff test.html
> >
> > Nothing.
>
> I don't know if it means anything, but incidently, "fossil diff" doesn't
> return anything either:
>
> d:\Temp>fossil diff test.html
>
> d:\Temp>fossil finfo test.html
>

That means there are no diffs to show. Try:

fossil gdiff --from prev test.html

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Martin Gagnon
On Sat, Aug 04, 2018 at 04:25:28PM +0200, Gilles wrote:
> On 04/08/2018 15:51, Gilles wrote:
> >d:\Temp>fossil gdiff test.html
> >
> >Nothing.
> 
> I don't know if it means anything, but incidently, "fossil diff" doesn't
> return anything either:
> 
> d:\Temp>fossil diff test.html
> 
> d:\Temp>fossil finfo test.html
> History of test.html
> 2018-08-04 [6517de2577] Blah (user: fred, artifact: [e123cf7827], branch:
> trunk)
> 2018-08-04 [e711051a5a] Original files (user: fred, artifact: [7d257c6ae4],
> branch: trunk)

If you don't have any local changes, it's normal that it shows nothing.
If "fossil changes" return nothing, it will be the same for "diff" or
"gdiff".

Fossil will not try to run the gdiff-command if there's no change.

Try again after modifying the file.

-- 
Martin G.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Gilles

On 04/08/2018 15:51, Gilles wrote:

d:\Temp>fossil gdiff test.html

Nothing.


I don't know if it means anything, but incidently, "fossil diff" doesn't 
return anything either:


d:\Temp>fossil diff test.html

d:\Temp>fossil finfo test.html
History of test.html
2018-08-04 [6517de2577] Blah (user: fred, artifact: [e123cf7827], 
branch: trunk)
2018-08-04 [e711051a5a] Original files (user: fred, artifact: 
[7d257c6ae4], branch: trunk)

___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Gilles

On 04/08/2018 15:36, Martin Gagnon wrote:
You can try to add "C:\Program Files\WinMerge" to your PATH 
environment variable.

Then start a cmd window and try if it works by just typing winmergeu.

If it's works, this should works

fossil set gdiff-command winmergeu
fossil gdiff myfile.txt


Thanks for the tip.

"C:\Program Files\WinMerge" was already in my system PATH:

d:\Temp>echo %PATH%
C:\Program Files\Common Files\Oracle\Java\javapath;… C:\Program 
Files\WinMerge;C:\Program Files\UltraEdit\


And "d:\Temp>winmergeu" does launch Winmerge as expected.

Next, I added the shorter version:

d:\Temp>setx /M PATH "%PATH%;c:\PROGRA~1\WinMerge

d:\Temp>echo %PATH%
…C:\Program Files\WinMerge;C:\Program Files\UltraEdit\;C:\Program 
Files\Mercurial;"c:\PROGRA~1\WinMerge


d:\Temp>fossil set gdiff-command WinMergeU.exe

d:\Temp>fossil settings
…
gdiff-command    (local)  WinMergeU.exe

d:\Temp>fossil gdiff test.html

Nothing.

___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Martin Gagnon
On Sat, Aug 04, 2018 at 01:16:29PM +0200, Gilles wrote:
> Hello,
> 
> I have a couple of questions:
> 
> 1. Although fossil.exe is configured with…
> 
> fossil settings > gdiff-command    (global) "C:\Program
> Files\WinMerge\WinMergeU.exe"
> 
> … nothing happens when I run "fossil gdiff myfile.txt".

You can try to add "C:\Program Files\WinMerge" to your PATH environment
variable.

Then start a cmd window and try if it works by just typing winmergeu.

If it's works, this should works

   fossil set gdiff-command winmergeu
   fossil gdiff myfile.txt

-- 
Martin G.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Gilles

On 04/08/2018 15:17, Warren Young wrote:

On Aug 4, 2018, at 6:49 AM, Gilles  wrote:

d:\temp\> fossil gdiff myfile.txt

Nothing.

Is d:\temp a checkout directory?  What does “fossil stat” give in that 
directory?


Yes. I used "d:\temp" to investigate this issue on a dummy repo.

d:\Temp>fossil settings
gdiff-command    (global) C:/PROGRA~1/WinMerge/WINMER~1.EXE

d:\Temp>fossil stat
repository:   d:/Temp/my.repo
local-root:   d:/Temp/
config-db:    C:/Users/fred/AppData/Local/_fossil
checkout: 6517de2577504d8ca1b5a962db04ced55bfcaa72 2018-08-04 
13:28:00 UTC
parent:   e711051a5a175a1e7b30a5b477639d5947d86af6 2018-08-04 
13:27:00 UTC

tags: trunk
comment:  Blah (user: fred)
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Warren Young
On Aug 4, 2018, at 6:49 AM, Gilles  wrote:
> 
> d:\temp\> fossil gdiff myfile.txt
> 
> Nothing.

Is d:\temp a checkout directory?  What does “fossil stat” give in that 
directory?
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Gilles

On 04/08/2018 14:10, Warren Young wrote:
Also, realize that Fossil will accept any unique prefix for 
sub-commands. So, “fossil gd” is already a valid command: you don’t 
need the TAB. 

Thanks. Good enough.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Gilles

On 04/08/2018 14:07, Warren Young wrote:

Double check that the executable is in fact there, not somewhere else, like 
c:\Program Files (x86).

If that doesn’t work, try “dir /x c:\” and putting in the short version of the 
path to avoid the embedded space.  If I had to guess, it’s:

 c:\PROGRA~1\WinMerge\WinMergeU.exe

But check.  It could be ~2 or other things.

And if that still doesn’t work, try using forward slashes.  It’s possible this 
is running through sprintf() or similar internally to Fossil, so those 
backslashes are causing confusion.

Thanks much for the tip.

The program is, c:\Program Files\WinMerge\WinMergeU.exe", ie. 
"C:\PROGRA~1\WinMerge\WINMER~1.EXE"


At the root of C: , where fossil.exe lives:

c:\> fossil settings gdiff-command "C:\PROGRA~1\WinMerge\WINMER~1.EXE"
c:\> fossil settings
>> gdiff-command    (global) C:\PROGRA~1\WinMerge\WINMER~1.EXE
d:\temp\> fossil gdiff myfile.txt

Nothing.

c:\> fossil settings gdiff-command "C:/PROGRA~1/WinMerge/WINMER~1.EXE"
c:\> fossil settings
>> gdiff-command    (global) C:/PROGRA~1/WinMerge/WINMER~1.EXE
d:\temp\> fossil gdiff myfile.txt

Nothing.

I also ran the command in the work directory, still no go. Incidently, I 
notice that settings can be changed at the local level:

d:\temp\> fossil settings gdiff-command "C:/PROGRA~1/WinMerge/WINMER~1.EXE"
d:\temp\> fossil settings
>> gdiff-command    (local) C:/PROGRA~1/WinMerge/WINMER~1.EXE
d:\temp\> fossil gdiff myfile.txt

Still nothing :-/
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] "fossil gdiff" doesn't launch WinMerge; fossil.exe with autocompletion?

2018-08-04 Thread Warren Young
On Aug 4, 2018, at 5:16 AM, Gilles  wrote:
> 
> fossil settings > gdiff-command(global) "C:\Program 
> Files\WinMerge\WinMergeU.exe”

Double check that the executable is in fact there, not somewhere else, like 
c:\Program Files (x86).

If that doesn’t work, try “dir /x c:\” and putting in the short version of the 
path to avoid the embedded space.  If I had to guess, it’s:

c:\PROGRA~1\WinMerge\WinMergeU.exe

But check.  It could be ~2 or other things.

And if that still doesn’t work, try using forward slashes.  It’s possible this 
is running through sprintf() or similar internally to Fossil, so those 
backslashes are causing confusion.

> 2. Is there a way to make fossil.exe autocomplete commands, eg.
> 
> fo + TAB : fossil.exe
> fossil gd + TAB : fossil gdiff
> fossil gdiff my + TAB :fossil gdiff myfile.txt

That’s not something fossil.exe can do, even in principle.  It’s a function of 
your shell, not of the command the shell is about to run.  fossil.exe hasn’t 
even run yet at the point where you’re wanting command argument completion.

There are several advanced shells for Windows (e.g Cmder), but I don’t pay much 
attention to that space, so I can’t actually give any recommendations.

If you are willing to use a POSIX type shell on Windows, several of the 
advanced shells can be configured to do this.  E.g. with Bash:

https://hackaday.com/2018/01/19/linux-fu-custom-bash-command-completion/

Zsh can also certainly do it, and probably Fish as well.

Such shells are vastly superior to cmd.exe anyway.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users