Re: [fossil-users] Propose changes

2012-06-12 Thread Baruch Burstein
On Tue, Jun 12, 2012 at 1:06 AM, Stephan Beal sgb...@googlemail.com wrote:

 On Mon, Jun 11, 2012 at 10:01 PM, Baruch Burstein bmburst...@gmail.comwrote:

 +** (versionable)   text files which should have CR+NL line endings
 +** automatically fixed to CR



 LOL! As much as i agree with the sentiment, isn't saying fixed likely to
 alienate users of that other OS?

I happen to be one of those users. That is why I find this useful. If I am
not careful when writing my files, I end up with warnings on every
check-in. It is fixed in the sense that Fossil seems to prefer CR line
endings (it never warns about those :), so this fixes it to fossils
preference (and my own, since I often end up using these files later on
other OSs)



 --
 - stephan beal
 http://wanderinghorse.net/home/stephan/
 http://gplus.to/sgbeal


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




-- 
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
___
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] Propose changes

2012-06-12 Thread Baruch Burstein
On Tue, Jun 12, 2012 at 1:36 AM, Mike Meyer m...@mired.org wrote:


 On Tue, 12 Jun 2012 00:06:38 +0200
 Stephan Beal sgb...@googlemail.com wrote:

  On Mon, Jun 11, 2012 at 10:01 PM, Baruch Burstein bmburst...@gmail.com
 wrote:
 
   +** (versionable)   text files which should have CR+NL line endings
   +** automatically fixed to CR
  LOL! As much as i agree with the sentiment, isn't saying fixed likely
 to
  alienate users of that other OS?

 So is there a setting for this variable that breaks text files when
 you check them out?

Um..., no. If you fix a file, it will also fix your current checkout to
match the fixed file in the repository, but any other open checked-outs
will get fixed (or get conflicts) when doing an update.
This setting is most likely useful for new repositories or existing ones
that already make sure to use only UNIX line endings. It will likely mess
up repositories with existing Windows line endings.

-- 
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
___
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] Propose changes

2012-06-12 Thread Mike Meyer
On Tue, 12 Jun 2012 10:32:14 +0300
Baruch Burstein bmburst...@gmail.com wrote:
 On Tue, Jun 12, 2012 at 1:36 AM, Mike Meyer m...@mired.org wrote:
  On Tue, 12 Jun 2012 00:06:38 +0200
  Stephan Beal sgb...@googlemail.com wrote:
   On Mon, Jun 11, 2012 at 10:01 PM, Baruch Burstein bmburst...@gmail.com
  wrote:
+** (versionable)   text files which should have CR+NL line endings
+** automatically fixed to CR
   LOL! As much as i agree with the sentiment, isn't saying fixed likely
  to
   alienate users of that other OS?
  So is there a setting for this variable that breaks text files when
  you check them out?
 Um..., no. If you fix a file, it will also fix your current checkout to
 match the fixed file in the repository, but any other open checked-outs
 will get fixed (or get conflicts) when doing an update.

To bad. The only SCM I ever used where we *never* had line ending
problems behaved that way. Only it wasn't optional, and they described
it as line endings are converted to canonical form when you check in
text files, and converted to the local representation when you check
files out (this was before Apple had switched to Unix, Macs still
used \r).

 This setting is most likely useful for new repositories or existing ones
 that already make sure to use only UNIX line endings. It will likely mess
 up repositories with existing Windows line endings.

True either way. And unfortunately, not fixable. You might be able to
correct the source code in a single commit to isolate the changes, but
history is immutable.

mike
-- 
Mike Meyer m...@mired.org http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

O ascii ribbon campaign - stop html mail - www.asciiribbon.org
___
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] Propose changes

2012-06-12 Thread Peter Spjuth
On Mon, Jun 11, 2012 at 10:01 PM, Baruch Burstein bmburst...@gmail.com wrote:
 +**    crnl-autofix-glob  A comma or newline-separated list of GLOB patterns 
 for
 +** (versionable)   text files which should have CR+NL line endings
 +** automatically fixed to CR

You have a typo there, it probably should be fixed to NL since you
are removing CR.

/Peter
___
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] Propose changes

2012-06-12 Thread Stephan Beal
On Tue, Jun 12, 2012 at 6:37 PM, Mike Meyer m...@mired.org wrote:

 True either way. And unfortunately, not fixable. You might be able to
 correct the source code in a single commit to isolate the changes, but
 history is immutable.


The vast majority of tools nowadays work just fine with \r\n or \ (barring
minor unsightlinesses like ^M at the end of each line in emacs). So why all
the trouble to fix/normalize/canonicalize the newlines? The only tool i use
which actively complains about them anymore is fossil. In fact, that very
feature really got on my nerves a couple days ago - i was working with
3rd-party java code, typed in a commit, and left the PC. A few hours later
i came back and fossil was still sitting there at the accept CRNL?
prompt. (Then i finally  took the trouble to read the docs for crnl-glob.)

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] Propose changes

2012-06-11 Thread Baruch Burstein
I have made a small addition that I would like to propose for fossil
(option to auto-convert line endings). How and where should I send it?

-- 
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
___
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] Propose changes

2012-06-11 Thread Richard Hipp
On Mon, Jun 11, 2012 at 3:12 PM, Baruch Burstein bmburst...@gmail.comwrote:

 I have made a small addition that I would like to propose for fossil
 (option to auto-convert line endings). How and where should I send it?


Post the diffs, or a link to the diffs, on this mailing list.




 --
 ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı


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




-- 
D. Richard Hipp
d...@sqlite.org
___
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] Propose changes

2012-06-11 Thread Baruch Burstein
I would also like to suggest a link to the command list (
http://www.fossil-scm.org/fossil/help) be available on the front page of
the website.

On Mon, Jun 11, 2012 at 11:01 PM, Baruch Burstein bmburst...@gmail.comwrote:

 Here it is. If you prefer a link I will upload it somewhere:


 --- src/db.c
 +++ src/db.c
 @@ -1894,10 +1894,11 @@
{ autosync,  0,0, 0, on  },
{ binary-glob,   0,   32, 1, },
{ clearsign, 0,0, 0, off },
{ case-sensitive,0,0, 0, on  },
{ crnl-glob, 0,   16, 1, },
 +  { crnl-autofix-glob,  0,  16, 1, },
{ default-perms, 0,   16, 0, u   },
{ diff-command,  0,   16, 0, },
{ dont-push, 0,0, 0, off },
{ editor,0,   16, 0, },
{ gdiff-command, 0,   16, 0, gdiff   },
 @@ -1983,10 +1984,14 @@
  ** be unsigned.  Default: off
  **
  **crnl-globA comma or newline-separated list of GLOB patterns
 for
  ** (versionable)   text files in which it is ok to have CR+NL line
 endings.
  ** Set to * to disable CR+NL checking.
 +**
 +**crnl-autofix-glob  A comma or newline-separated list of GLOB
 patterns for
 +** (versionable)   text files which should have CR+NL line endings
 +** automatically fixed to CR
  **
  **default-permsPermissions given automatically to new users.  For
 more
  ** information on permissions see Users page in Server
  ** Administration of the HTTP UI. Default: u.
  **

 --- src/checkin.c
 +++ src/checkin.c
 @@ -816,16 +816,24 @@
blob_appendf(pOut, U %F\n, zUserOvrd ? zUserOvrd : g.zLogin);
md5sum_blob(pOut, mcksum);
blob_appendf(pOut, Z %b\n, mcksum);
if( pnFBcard ) *pnFBcard = nFBcard;
  }
 +
 +/*
 +** Correct al \r\n line endings in a text file to \n
 +*/
 +static void cr_fix(Blob *p, const char *zFilename){
 +  blob_remove_cr(p);
 +  blob_write_to_file(p, zFilename);
 +}

  /*
  ** Issue a warning and give the user an opportunity to abandon out
  ** if a \r\n line ending is seen in a text file.
  */
 -static void cr_warning(const Blob *p, const char *zFilename){
 +static void cr_warning(Blob *p, const char *zFilename){
int nCrNl = 0;  /* Number of \r\n line endings seen */
const unsigned char *z; /* File text */
int n;  /* Size of the file in bytes */
int lastNl = 0; /* Characters since last \n */
int i;  /* Loop counter */
 @@ -854,17 +862,19 @@
if( nCrNl ){
  char c;
  file_relative_name(zFilename, fname, 0);
  blob_zero(ans);
  zMsg = mprintf(
 - %s contains CR/NL line endings; commit anyhow (yes/no/all)?,
 + %s contains CR/NL line endings; commit anyhow
 (yes/no/all/fix)?,
   blob_str(fname));
  prompt_user(zMsg, ans);
  fossil_free(zMsg);
  c = blob_str(ans)[0];
  if( c=='a' ){
allOk = 1;
 +}else if( c=='f' ){
 +  cr_fix(p, zFilename);
  }else if( c!='y' ){
fossil_fatal(Abandoning commit due to CR+NL line endings in %s,
 blob_str(fname));
  }
  blob_reset(ans);
 @@ -1150,33 +1160,42 @@
/* Step 1: Insert records for all modified files into the blob
** table. If there were arguments passed to this command, only
** the identified fils are inserted (if they have been modified).
*/
db_prepare(q,
 -SELECT id, %Q || pathname, mrid, %s FROM vfile 
 +SELECT id, %Q || pathname, mrid, %s, %s FROM vfile 
  WHERE chnged==1 AND NOT deleted AND file_is_selected(id),
 -g.zLocalRoot, glob_expr(pathname, db_get(crnl-glob,))
 +g.zLocalRoot,
 +glob_expr(pathname, db_get(crnl-glob,)),
 +glob_expr(pathname, db_get(crnl-autofix-glob,))
);
while( db_step(q)==SQLITE_ROW ){
  int id, rid;
  const char *zFullname;
  Blob content;
 -int crnlOk;
 +int crnlOk, crnlFix;

  id = db_column_int(q, 0);
  zFullname = db_column_text(q, 1);
  rid = db_column_int(q, 2);
  crnlOk = db_column_int(q, 3);
 +crnlFix = db_column_int(q, 4);

  blob_zero(content);
  if( file_wd_islink(zFullname) ){
/* Instead of file content, put link destination path */
blob_read_link(content, zFullname);
  }else{
blob_read_from_file(content, zFullname);
  }
 -if( !crnlOk ) cr_warning(content, zFullname);
 +if( !crnlOk ){
 +  if( crnlFix ){
 +cr_fix(content, zFullname);
 +  }else{
 +cr_warning(content, zFullname);
 +  }
 +}
  nrid = content_put(content);
  blob_reset(content);
  if( rid0 ){
content_deltify(rid, nrid, 0);

 

Re: [fossil-users] Propose changes

2012-06-11 Thread Stephan Beal
On Mon, Jun 11, 2012 at 10:01 PM, Baruch Burstein bmburst...@gmail.comwrote:

 +** (versionable)   text files which should have CR+NL line endings
 +** automatically fixed to CR



LOL! As much as i agree with the sentiment, isn't saying fixed likely to
alienate users of that other OS?


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

2012-06-11 Thread Mike Meyer

On Tue, 12 Jun 2012 00:06:38 +0200
Stephan Beal sgb...@googlemail.com wrote:

 On Mon, Jun 11, 2012 at 10:01 PM, Baruch Burstein bmburst...@gmail.comwrote:
 
  +** (versionable)   text files which should have CR+NL line endings
  +** automatically fixed to CR
 LOL! As much as i agree with the sentiment, isn't saying fixed likely to
 alienate users of that other OS?

So is there a setting for this variable that breaks text files when
you check them out?

mike
-- 
Mike Meyer m...@mired.org http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

O ascii ribbon campaign - stop html mail - www.asciiribbon.org
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users