Re: [fossil-users] getloadavg() detection

2014-04-01 Thread Jan Nijtmans
2014-04-02 2:24 GMT+02:00 Joseph Prostko :
> Below is a patch via `fossil diff` to detect getloadavg() which allows
> Fossil to build cleanly on Haiku (and potentially other systems that
> would happen not to have getloadavg() available.



Thanks!

  Jan Nijtmans
___
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] SIGSEGV on CR/NL convert for read-only files

2014-04-01 Thread Martin Gagnon
On Tue, Apr 01, 2014 at 09:35:19PM -0500, Andy Goth wrote:
> src/checkin.c fea64cb746964053193c12937d90a7ba42b625fc line 1315
> gives me a SIGSEGV.  This is because the f argument is NULL due to
> fossil_open() failing on line 1305 with EACCESS because the file I'm
> checking in happens to be read-only.
> 

Fixed on trunk.  Now fossil will exit with error message telling what
file cannot be open for writing.

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


[fossil-users] RCS import

2014-04-01 Thread Andy Goth
The attached script imports an RCS repository into Fossil.  It doesn't 
support branching nor symbolic names, and it has a few peculiarities 
designed to accommodate the RCS repository I just processed.


--
Andy Goth | 
#!/usr/bin/env tclsh

package require Tcl 8.6

# Confirm command line arguments.
if {[llength $argv] != 2} {
puts stderr "Usage: [file tail $argv0] INPUT_RCS OUTPUT_FOSSIL"
exit 1
}
set input [file normalize [lindex $argv 0]]
set output [file normalize [lindex $argv 1]]

# Executes a program after printing the command line.
proc run {args} {
puts $args
exec {*}$args
}

# Formats timestamps the way Fossil likes them.
proc fossilTime {timestamp} {
clock format $timestamp -format "%Y-%m-%d %T"
}

# Find all RCS files and load their logs into $database.
set dirs [list $input]
set database {}
while {[llength $dirs]} {
# Dequeue the first directory off the list and enqueue its subdirectories.
set dirs [concat [lassign $dirs dir] [glob -nocomplain -dir $dir -type d *]]

# Process all RCS files inside the directory.
foreach file [glob -nocomplain -directory $dir -type f *,v] {
# Determine the working file name by stripping the input root path, the
# ",v" suffix, and (if present) the RCS subdirectory component.
regsub {/RCS/(?=[^/]*$)} [regsub {,v$} [string range $file\
[expr {[string length $input] + 1}] end] {}] / name

# Obtain the log, sans header.
regsub {.*?\n-{28}\n} [run rlog $file] {} data

# Process each revision.
set start 0
while {[regexp -start $start -indices {\n-{28}\n|\n={77}$} $data sep]} {
# Get the revision body text, and find the start of the next block.
set body [string range $data $start [expr {[lindex $sep 0] - 1}]]
set start [expr {[lindex $sep 1] + 1}]

# Extract the fields from the revision body.
regexp -expanded {
^revision\ ([\d.]+)[^\n]*\n
date:\ ([\d/ :]+);\ *
author:\ ([^;]+);\ *
state:\ [^;]+;\ *
(?:lines:\ [^\n]+)?\n
(.*)$
} $body _ revision date author message
set date [clock scan $date -format "%Y/%m/%d %T"]

# Process the message.
if {[set sep [string first "\n@:" $message]] >= 0} {
set extra [string trim [regsub -line -all {^@: *}\
[string range $message $sep end] {}]]
set message [string trim [string range $message\
0 [expr {$sep - 1}]]]
if {$extra ne {} && $extra ne $message} {
append message \n $extra
}
} else {
set message [string trim $message]
}

# Store the revision data in the database.
lappend database $date $name $revision $author $message
}
}
}

# Sort the database so the oldest entry is first.
set database [lsort -integer -stride 5 $database]

# Create the Fossil repository.
set lastDate [expr {[lindex $database 0] - 1}]
run fossil new --date-override [fossilTime $lastDate] $output
file mkdir tmp
cd tmp
run fossil open $output

# Process all revision data from oldest to newest.
set users [dict create [run fossil user default] {}]
foreach {date name revision author message} $database {
# Forbid equal timestamps.
if {[info exists lastDate] && $date <= $lastDate} {
set date [expr {$lastDate + 1}]
}

# Create users as they are first encountered.
if {![dict exists $users $author]} {
dict set users $author {}
run fossil user new $author {} {}
}

# Extract the file from RCS and place into the temporary directory.
run co -r$revision [file join $input $name] 2> /dev/null
if {![set exists [file exists $name]]} {
file mkdir [file dirname $name]
}
file rename -force [file join $input $name] $name
file attributes $name -permissions\
[expr {[file attributes $name -permissions] | 0600}]

# Make sure the file has Unix line endings.
if {[regexp {, with CRLF line terminators$} [run file $name]]} {
set chan [open $name]
chan configure $chan -translation crlf
set data [chan read $chan]
chan close $chan
set chan [open $name w]
chan puts -nonewline $chan $data
chan close $chan
}

# Add or update the file in the Fossil repository.
if {!$exists} {
run fossil add $name
}
run fossil commit --sha1sum --no-warnings --allow-empty\
--user-override $author --date-override [fossilTime $date]\
--comment $message
}
run fossil close

# vim: set sts=4 sw=4 tw=80 et ft=tcl:
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] SIGSEGV on CR/NL convert for read-only files

2014-04-01 Thread Andy Goth
src/checkin.c fea64cb746964053193c12937d90a7ba42b625fc line 1315 gives 
me a SIGSEGV.  This is because the f argument is NULL due to 
fossil_open() failing on line 1305 with EACCESS because the file I'm 
checking in happens to be read-only.


--
Andy Goth | 
___
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] getloadavg() detection

2014-04-01 Thread Joseph Prostko
On Tue, Apr 1, 2014 at 8:24 PM, Joseph Prostko  wrote:

> Below is a patch via `fossil diff` to detect getloadavg() which allows
> Fossil to build cleanly on Haiku (and potentially other systems that
> would happen not to have getloadavg() available.

My mail client wrapped text, unfortunately, but seeing as it is a
simple patch, it can probably essentially be copied/pasted into
auto.def.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] getloadavg() detection

2014-04-01 Thread Joseph Prostko
Hello,

I was trying to build a recent version of Fossil on Haiku, and noticed
that the build failed due to there not being getloadavg() on the
platform.

Below is a patch via `fossil diff` to detect getloadavg() which allows
Fossil to build cleanly on Haiku (and potentially other systems that
would happen not to have getloadavg() available.


Index: auto.def
==
--- auto.def
+++ auto.def
@@ -248,10 +248,15 @@
 if {[string match *mingw* [get-define host]]} {
 define-append LIBS -lwsock32
 }
 }
 cc-check-function-in-lib iconv iconv
+
+# Check for getloadavg(), and if it doesn't exist, define
FOSSIL_OMIT_LOAD_AVERAGE
+if {![cc-check-functions getloadavg]} {
+  define FOSSIL_OMIT_LOAD_AVERAGE 1
+}

 # Check for getpassphrase() for Solaris 10 where getpass() truncates
to 10 chars
 if {![cc-check-functions getpassphrase]} {
 # Haiku needs this
 cc-check-function-in-lib getpass bsd
___
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] TH: unary bitwise operator

2014-04-01 Thread Joe Mistachkin

Sergei Gavrikov wrote:
> 
>  % fossil test-th-eval 'expr ~1234'
>   fossil: ../src/th.c:2002: exprEval: Assertion `!"Internal error"'
failed.
>  

Thanks for the report, fixed now on trunk.

--
Joe Mistachkin

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


[fossil-users] TH: unary bitwise operator

2014-04-01 Thread Sergei Gavrikov
Hi

[FYI]

  % fossil test-th-eval 'expr ~1234'
  fossil: ../src/th.c:2002: exprEval: Assertion `!"Internal error"' failed.

Sergei

Index: src/th.c
==
--- src/th.c
+++ src/th.c
@@ -1996,10 +1996,11 @@
 case OP_BITWISE_OR:   iRes = iLeft|iRight;  break;
 case OP_LOGICAL_AND:  iRes = iLeft&&iRight; break;
 case OP_LOGICAL_OR:   iRes = iLeft||iRight; break;
 case OP_UNARY_MINUS:  iRes = -iLeft;break;
 case OP_UNARY_PLUS:   iRes = +iLeft;break;
+case OP_BITWISE_NOT:  iRes = ~iLeft;break;
 case OP_LOGICAL_NOT:  iRes = !iLeft;break;
 default: assert(!"Internal error");
   }
   Th_SetResultInt(interp, iRes);
 }else if( rc==TH_OK && eArgType==ARG_NUMBER ){

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


[fossil-users] a minor plea: #Fossil hashtag

2014-04-01 Thread Stephan Beal
Hi, all,

a small plea to those of you who like to use the #Fossil hashtag in your
online posts: if you wouldn't mind, please instead (or in addition) use
#FossilSCM (or #FossilScm), as #Fossil is apparently used for other
purposes and searches closely associate it with watches (the Fossil watch
brand).

(Of course, that's not a "must" - just a suggestion - i'd like to see
fossil be easily findable in G+.)

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"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


[fossil-users] libfossil minor milestone: diff app

2014-04-01 Thread Stephan Beal
Hi, all,

another minor milestone has been reached in the long and glorious libfossil
effort: a CLI app which can generate diffs of arbitrary versions:

[stephan@host:~/cvs/fossil/libfossil/f-apps]$ ./f-vdiff prev current
DIFF: a4835dda ==> afaa2806 f-apps/f-adiff.c
@@ -105,7 +105,7 @@
   if(fcli_flag2("h", "html", NULL)){
 diffOpt.diffFlags |= FSL_DIFF_HTML;
   }
-  if(isatty(STDOUT_FILENO)
+  if(fsl_isatty(1)
  && !fcli_flag2("bw", "no-color", NULL)){
 diffOpt.diffFlags |= FSL_DIFF_ANSI_COLOR;
   }
DIFF: 06ec7bc2 ==> 3ed78c3d f-apps/f-vdiff.c
@@ -24,15 +24,42 @@
 /* #include "fossil-scm/fossil-internal.h" */
...

(The output isn't quiet conventions-conformant yet, but the app is only
about 30 minutes old.)

A summary of features and bugs:

[stephan@host:~/cvs/fossil/libfossil/f-apps]$ f-vdiff prev current -?
Usage:
f-vdiff [options]version1 version2

--from|-v1=VERSION the first version. May optionally be provided as the
first non-flag argument.

--to|-v2=VERSION the second version. May optionally be provided as the
second non-flag argument.

--width|-w=INTEGER enables side-by-side diffs width the given width.

--sbs is equivalent to --width=SOME_UNSPECIFIED_DEFAULT.

--no-color|-bw disables ANSI colorizing of output.

--html generates an HTML-format diff.

--invert|-i inverts the diffs (not the versions nor other displayed
components, e.g. ordering of UUIDs).

--glob|-g=STRING only lists changes to filenames matching the given glob.
There is probably a corner case or two involving renamed files, in
particular when diffing against more than one version away from the
original.

KNOWN BUGS:
1) this app cannot currently diff against the checkout version. All the
pieces are in place, it just needs to be done.
2) The unified diff(-like) output is not quite yet patch-compatible.


Whenever you're ready to try out alternatives to some of Fossil's features:

http://fossil.wanderinghorse.net/repos/libfossil/index.cgi/wiki?name=f-tools

PS: for interested C coders: the implementation was not all that difficult,
but it does require an understanding of how to traverse "manifests" in
fossil:

http://fossil.wanderinghorse.net/repos/libfossil/index.cgi/finfo?name=f-apps/f-vdiff.c

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"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