Re: [fossil-users] zip/tar patch

2012-02-11 Thread frantisek holop

any interest in this simple patch?


hmm, on Tue, Feb 07, 2012 at 07:48:30PM +0100, frantisek holop said that
 hi there,
 
 the motivation for this patch was that the zip and tarball links
 from the web ui get a filename and checkout for free, while they
 are a mandatory parameters for the command line.
 
 so i tried to unify it a bit: the default archive name is now both
 from web and cli the same, a lowercased project name followed by the
 artifact ID.  spaces are substituted with '-'.
 
 $ fossil zip
 fossil-030035345c.zip: 2944427 bytes
 
 $ fossil zip tip
 fossil-030035345c.zip: 2944427 bytes
 
 $ fossil zip -o f.zip
 f.zip: 2944427 bytes
 
 $ fossil zip -o f.zip tip
 f.zip: 2944427 bytes
 
 $ fossil tar
 fossil-030035345c.tgz: 2944427 bytes
 
 $ fossil tar tip
 fossil-030035345c.tgz: 2944427 bytes
 
 $ fossil tar -o f.tgz
 f.zip: 2944427 bytes
 
 $ fossil tar -o f.tgz tip
 f.zip: 2944427 bytes
 
 
 $ fossil help zip
 Usage: fossil zip [--name DIRECTORY] [-o OUTPUTFILE]
   [-R REPOSITORY] [VERSION]
 
 Generate a ZIP archive containing VERSION of the checkout.
 If VERSION is omitted, the current checkout is used.
 
 The name of the resulting archive can be set using the -o option,
 otherwise it will be derived from the project name followed by the
 check-in's artifact ID.  Unless the --name option is specified, the
 the top-level directory inside the archive will have the same name.
 
 Options:
   --name DIRECTORY  Name of the top-level directory inside
 the archive.
   -o OUTPUTFILE Name of the archive.
   -R|--repository FILE  Use the repository in FILE.
 
 See also: tarball
 
 
 
 --- src/info.c
 +++ src/info.c
 @@ -500,11 +500,18 @@
  @ td%h(zUser) @ %h(zIpAddr) on %s(zDate)/td/tr
}
db_finalize(q);
  }
  if( g.perm.History ){
 -  const char *zProjName = db_get(project-name, unnamed);
 +  char *zProjName = db_get(project-name, unnamed);
 +  int i;
 +  for(i=0; istrlen(zProjName); i++){
 +zProjName[i] = fossil_tolower(zProjName[i]);
 +if( zProjName[i]==' ' ){
 +   zProjName[i] = '-';
 + }
 +  }
@ trthTimelines:/thtd
@   a href=%s(g.zTop)/timeline?f=%S(zUuid)family/a
if( zParent ){
  @ | a href=%s(g.zTop)/timeline?p=%S(zUuid)ancestors/a
}
 @@ -526,16 +533,14 @@
@ /td/tr
@ trthOthernbsp;Links:/th
@   td
@ a href=%s(g.zTop)/dir?ci=%S(zUuid)files/a
if( g.perm.Zip ){
 -char *zUrl = mprintf(%s/tarball/%s-%S.tar.gz?uuid=%s,
 - g.zTop, zProjName, zUuid, zUuid);
 -@ | a href=%s(zUrl)Tarball/a
 +@ | a 
 href=%s(g.zTop)/tarball/%s(zProjName)-%S(zUuid).tgz=%s(zUuid)
 +@ Tarball/a
  @ | a 
 href=%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)
  @ ZIP archive/a
 -fossil_free(zUrl);
}
@   | a href=%s(g.zTop)/artifact/%S(zUuid)manifest/a
if( g.perm.Write ){
  @   | a href=%s(g.zTop)/ci_edit?r=%S(zUuid)edit/a
}
 
 --- src/tar.c
 +++ src/tar.c
 @@ -525,42 +525,63 @@
  }
  
  /*
  ** COMMAND: tarball*
  **
 -** Usage: %fossil tarball VERSION OUTPUTFILE [--name DIRECTORYNAME] 
 [-R|--repository REPO]
 +** Usage: %fossil tarball [--name DIRECTORY] [-o OUTPUTFILE]
 +**   [-R REPOSITORY] VERSION
 +**
 +** Generate a compressed tarball archive containing VERSION of the
 +** project.  If VERSION is omitted, the current checkout is used.
 +**
 +** The name of the resulting archive can be set using the -o option,
 +** otherwise it will be derived from the project name followed by the
 +** check-in's artifact ID.  Unless the --name option is specified, the
 +** the top-level directory inside the archive will have the same name.
 +**
 +** Options:
 +**   --name DIRECTORY  Name of the top-level directory inside
 +** the archive.
 +**   -o OUTPUTFILE Name of the archive.
 +**   -R|--repository FILE  Use the repository in FILE.
  **
 -** Generate a compressed tarball for a specified version.  If the --name
 -** option is used, its argument becomes the name of the top-level directory
 -** in the resulting tarball.  If --name is omitted, the top-level directory
 -** named is derived from the project name, the check-in date and time, and
 -** the artifact ID of the check-in.
 +** See also: zip
  */
  void tarball_cmd(void){
int rid;
Blob tarball;
const char *zName;
 +  const char *fName;
 +  int wrote;
zName = find_option(name, 0, 1);
 +  fName = find_option(o, o, 1);
db_find_and_open_repository(0, 0);
 -  if( g.argc!=4 ){
 -usage(VERSION OUTPUTFILE);
 +  if( g.argc!=2  g.argc!=3 ){
 +usage([--name DIRECTORY] [-o OUTPUTFILE] [-R REPOSITORY] [VERSION]);
}
 -  rid = name_to_typed_rid(g.argv[2], ci);
 +  if( g.argc==3 ){
 +rid = name_to_typed_rid(g.argv[2], ci);
 +  }else{
 +rid = 

Re: [fossil-users] zip/tar patch

2012-02-11 Thread Matt Welland
On Sat, Feb 11, 2012 at 7:55 AM, frantisek holop min...@obiit.org wrote:


 any interest in this simple patch?


I think the proposed behavior is a good way to go.


 hmm, on Tue, Feb 07, 2012 at 07:48:30PM +0100, frantisek holop said that
  hi there,
 
  the motivation for this patch was that the zip and tarball links
  from the web ui get a filename and checkout for free, while they
  are a mandatory parameters for the command line.
 
  so i tried to unify it a bit: the default archive name is now both
  from web and cli the same, a lowercased project name followed by the
  artifact ID.  spaces are substituted with '-'.
 
  $ fossil zip
  fossil-030035345c.zip: 2944427 bytes
 
  $ fossil zip tip
  fossil-030035345c.zip: 2944427 bytes
 
  $ fossil zip -o f.zip
  f.zip: 2944427 bytes
 
  $ fossil zip -o f.zip tip
  f.zip: 2944427 bytes
 
  $ fossil tar
  fossil-030035345c.tgz: 2944427 bytes
 
  $ fossil tar tip
  fossil-030035345c.tgz: 2944427 bytes
 
  $ fossil tar -o f.tgz
  f.zip: 2944427 bytes
 
  $ fossil tar -o f.tgz tip
  f.zip: 2944427 bytes
 
 
  $ fossil help zip
  Usage: fossil zip [--name DIRECTORY] [-o OUTPUTFILE]
[-R REPOSITORY] [VERSION]
 
  Generate a ZIP archive containing VERSION of the checkout.
  If VERSION is omitted, the current checkout is used.
 
  The name of the resulting archive can be set using the -o option,
  otherwise it will be derived from the project name followed by the
  check-in's artifact ID.  Unless the --name option is specified, the
  the top-level directory inside the archive will have the same name.
 
  Options:
--name DIRECTORY  Name of the top-level directory inside
  the archive.
-o OUTPUTFILE Name of the archive.
-R|--repository FILE  Use the repository in FILE.
 
  See also: tarball
 
 
 
  --- src/info.c
  +++ src/info.c
  @@ -500,11 +500,18 @@
   @ td%h(zUser) @ %h(zIpAddr) on %s(zDate)/td/tr
 }
 db_finalize(q);
   }
   if( g.perm.History ){
  -  const char *zProjName = db_get(project-name, unnamed);
  +  char *zProjName = db_get(project-name, unnamed);
  +  int i;
  +  for(i=0; istrlen(zProjName); i++){
  +zProjName[i] = fossil_tolower(zProjName[i]);
  +if( zProjName[i]==' ' ){
  +   zProjName[i] = '-';
  + }
  +  }
 @ trthTimelines:/thtd
 @   a href=%s(g.zTop)/timeline?f=%S(zUuid)family/a
 if( zParent ){
   @ | a href=%s(g.zTop)/timeline?p=%S(zUuid)ancestors/a
 }
  @@ -526,16 +533,14 @@
 @ /td/tr
 @ trthOthernbsp;Links:/th
 @   td
 @ a href=%s(g.zTop)/dir?ci=%S(zUuid)files/a
 if( g.perm.Zip ){
  -char *zUrl = mprintf(%s/tarball/%s-%S.tar.gz?uuid=%s,
  - g.zTop, zProjName, zUuid, zUuid);
  -@ | a href=%s(zUrl)Tarball/a
  +@ | a
 href=%s(g.zTop)/tarball/%s(zProjName)-%S(zUuid).tgz=%s(zUuid)
  +@ Tarball/a
   @ | a
 href=%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)
   @ ZIP archive/a
  -fossil_free(zUrl);
 }
 @   | a href=%s(g.zTop)/artifact/%S(zUuid)manifest/a
 if( g.perm.Write ){
   @   | a href=%s(g.zTop)/ci_edit?r=%S(zUuid)edit/a
 }
 
  --- src/tar.c
  +++ src/tar.c
  @@ -525,42 +525,63 @@
   }
 
   /*
   ** COMMAND: tarball*
   **
  -** Usage: %fossil tarball VERSION OUTPUTFILE [--name DIRECTORYNAME]
 [-R|--repository REPO]
  +** Usage: %fossil tarball [--name DIRECTORY] [-o OUTPUTFILE]
  +**   [-R REPOSITORY] VERSION
  +**
  +** Generate a compressed tarball archive containing VERSION of the
  +** project.  If VERSION is omitted, the current checkout is used.
  +**
  +** The name of the resulting archive can be set using the -o option,
  +** otherwise it will be derived from the project name followed by the
  +** check-in's artifact ID.  Unless the --name option is specified, the
  +** the top-level directory inside the archive will have the same name.
  +**
  +** Options:
  +**   --name DIRECTORY  Name of the top-level directory inside
  +** the archive.
  +**   -o OUTPUTFILE Name of the archive.
  +**   -R|--repository FILE  Use the repository in FILE.
   **
  -** Generate a compressed tarball for a specified version.  If the --name
  -** option is used, its argument becomes the name of the top-level
 directory
  -** in the resulting tarball.  If --name is omitted, the top-level
 directory
  -** named is derived from the project name, the check-in date and time,
 and
  -** the artifact ID of the check-in.
  +** See also: zip
   */
   void tarball_cmd(void){
 int rid;
 Blob tarball;
 const char *zName;
  +  const char *fName;
  +  int wrote;
 zName = find_option(name, 0, 1);
  +  fName = find_option(o, o, 1);
 db_find_and_open_repository(0, 0);
  -  if( g.argc!=4 ){
  -usage(VERSION OUTPUTFILE);
  

Re: [fossil-users] zip/tar patch

2012-02-11 Thread Lluís Batlle i Rossell
On Sat, Feb 11, 2012 at 03:55:10PM +0100, frantisek holop wrote:
 
 any interest in this simple patch?

In general I don't mind. But in particular:
a) the patch has wrong indentation in some places
b) I prefer .tar.gz over .tgz
c) I like *both* uuid and date in the file names

Regards,
Lluís.

 hmm, on Tue, Feb 07, 2012 at 07:48:30PM +0100, frantisek holop said that
  hi there,
  
  the motivation for this patch was that the zip and tarball links
  from the web ui get a filename and checkout for free, while they
  are a mandatory parameters for the command line.
  
  so i tried to unify it a bit: the default archive name is now both
  from web and cli the same, a lowercased project name followed by the
  artifact ID.  spaces are substituted with '-'.
___
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] zip/tar patch

2012-02-11 Thread frantisek holop
hmm, on Sat, Feb 11, 2012 at 05:27:41PM +0100, Lluís Batlle i Rossell said that
 On Sat, Feb 11, 2012 at 03:55:10PM +0100, frantisek holop wrote:
  
  any interest in this simple patch?
 
 In general I don't mind. But in particular:
 a) the patch has wrong indentation in some places

could you be more speficic please?  i tried to follow the main style
but i admit its not my preferred indentation.

 b) I prefer .tar.gz over .tgz
 c) I like *both* uuid and date in the file names

i guess these will be the final decision of the project
leader.. unless using placeholders, there is no chance
to please everyone.  in my patch i followed what the web
ui does as i thought that to be the preffered version.

-f
-- 
age is only skin deep.
___
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] zip/tar patch

2012-02-09 Thread Remigiusz Modrzejewski

On Feb 7, 2012, at 23:11 , Stephan Beal wrote:

 Agreed completely - spaces in filenames are evil. (let the flame wars begin
 ;)

Well, shouldn't a good filename start with  - anyways? ;)


Kind regards,
Remigiusz Modrzejewski



___
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] zip/tar patch

2012-02-09 Thread Stephan Beal
On Thu, Feb 9, 2012 at 6:08 PM, Remigiusz Modrzejewski
l...@maxnet.org.plwrote:

 Well, shouldn't a good filename start with  - anyways? ;)


i once administered a Solaris system where someone accidentally managed,
over a serial terminal, to touch a new file whos name was a single
backspace character (ASCII 0x08). The only way we managed to delete it was
deleting its parent directory.

-- 
- 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] zip/tar patch

2012-02-09 Thread MIURA Masahiro
On Fri, Feb 10, 2012 at 02:26, Stephan Beal sgb...@googlemail.com wrote:
 i once administered a Solaris system where someone accidentally managed,
 over a serial terminal, to touch a new file whos name was a single
 backspace character (ASCII 0x08). The only way we managed to delete it was
 deleting its parent directory.

Using Zsh on Linux, I can delete the file by 'rm ^H'.
('^H' is typed as ctrl-v ctrl-h.)
Also, 'rm ?' will do (after getting other single-letter-named files out).


-- 
MIURA Masahiro
echocham...@gmail.com
___
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] zip/tar patch

2012-02-09 Thread frantisek holop
hmm, on Fri, Feb 10, 2012 at 03:12:01AM +0900, MIURA Masahiro said that
 On Fri, Feb 10, 2012 at 02:26, Stephan Beal sgb...@googlemail.com wrote:
  i once administered a Solaris system where someone accidentally managed,
  over a serial terminal, to touch a new file whos name was a single
  backspace character (ASCII 0x08). The only way we managed to delete it was
  deleting its parent directory.
 
 Using Zsh on Linux, I can delete the file by 'rm ^H'.
 ('^H' is typed as ctrl-v ctrl-h.)
 Also, 'rm ?' will do (after getting other single-letter-named files out).

getting off-topic i am afraid, but it's also possible to delete
any fancy named files/directories by its inode :]

-f
-- 
god?  i'm no god.  god has mercy.
___
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] zip/tar patch

2012-02-07 Thread Stephan Beal
On Tue, Feb 7, 2012 at 7:48 PM, frantisek holop min...@obiit.org wrote:


 so i tried to unify it a bit: the default archive name is now both
 from web and cli the same, a lowercased project name followed by the
 artifact ID.  spaces are substituted with '-'.


Hi!

Out of curiosity: why force lower-case? That seems like an arbitrary
decision without a technical reason. i have one Java tree in Fossil for
which i highly prefer a CamelCasedName.

:-?

-- 
- 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] zip/tar patch

2012-02-07 Thread frantisek holop
hmm, on Tue, Feb 07, 2012 at 08:59:37PM +0100, Stephan Beal said that
 On Tue, Feb 7, 2012 at 7:48 PM, frantisek holop min...@obiit.org wrote:
 
 
  so i tried to unify it a bit: the default archive name is now both
  from web and cli the same, a lowercased project name followed by the
  artifact ID.  spaces are substituted with '-'.
 
 Out of curiosity: why force lower-case? That seems like an arbitrary
 decision without a technical reason. i have one Java tree in Fossil for
 which i highly prefer a CamelCasedName.

no reason really, matter of personal preference.  i was sure that
this part wouldnt be left without discussion :]

it is trivial to remove from the patch of course.

-f
-- 
dogmatism: puppyism come to its full growth.
___
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] zip/tar patch

2012-02-07 Thread Stephan Beal
On Tue, Feb 7, 2012 at 9:44 PM, frantisek holop min...@obiit.org wrote:

 hmm, on Tue, Feb 07, 2012 at 08:59:37PM +0100, Stephan Beal said that
  Out of curiosity: why force lower-case? That seems like an arbitrary
  decision without a technical reason. i have one Java tree in Fossil for
  which i highly prefer a CamelCasedName.

 no reason really, matter of personal preference.  i was sure that
 this part wouldnt be left without discussion :]


i thought maybe you did it just to get a reaction ;).

In any case, i like the feature, i just don't like the forced lower-casing.
(To be clear: not that my vote counts for anything!)

-- 
- 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] zip/tar patch

2012-02-07 Thread frantisek holop
hmm, on Tue, Feb 07, 2012 at 09:48:23PM +0100, Stephan Beal said that
 In any case, i like the feature, i just don't like the forced lower-casing.
 (To be clear: not that my vote counts for anything!)

well it all comes down to if project name is a good
data source for a filename..

anyway, i feel much stronger about spaces in filenames,
that is mostly asking for trouble.

-f
-- 
to my embarrassment, i was born in bed with a lady!
___
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] zip/tar patch

2012-02-07 Thread Stephan Beal
Agreed completely - spaces in filenames are evil. (let the flame wars begin
;)

- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
On Feb 7, 2012 10:21 PM, frantisek holop min...@obiit.org wrote:

 hmm, on Tue, Feb 07, 2012 at 09:48:23PM +0100, Stephan Beal said that
  In any case, i like the feature, i just don't like the forced
 lower-casing.
  (To be clear: not that my vote counts for anything!)

 well it all comes down to if project name is a good
 data source for a filename..

 anyway, i feel much stronger about spaces in filenames,
 that is mostly asking for trouble.

 -f
 --
 to my embarrassment, i was born in bed with a lady!
 ___
 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