[darcs-devel] darcs patch: Added --repodir argument to init (RT #10... (and 5 more)

Eric Kow eric.kow at gmail.com
Sat Mar 4 03:06:20 PST 2006


Juliusz and other developers,

Here is a slightly improved version of the absolute directories patch.
I send it with my --repodir patches, because there was a conflict
between one of them and the previous version of my patch, which I went
ahead and fixed, thus creating a dependency.  

I believe it is correct, but it would be nice if at least one third
party could review the patch first.

Sat Mar  4 03:41:50 CET 2006  Eric Kow <eric.kow at gmail.com>
  * Improved support for absolute paths (issue 32).
 
This patch corrects the problem where arguments in the repository were
not being recognised as such if they were provided as absolute paths.
My solution was to convert absolute paths into relative ones -- not all
of them, just the ones which are prefixed by the current repository and
a slash.  We do this by stripping off the first N characters.  The first
question is does the general scheme sound correct?  

The second question is where could things go wrong?  Here's what I
thought of, and my answers to them:

  - Not using the right absolute path for the current repository
      possible - most commands (except for changes) uses the
      current working directory first thing within withRepoLock.
      If I understand correctly, in withRepoLock, the cwd is the
      repository...
  - Converting things other than absolute paths: 
      ok - should never happen; we use is_absolute to make sure 
  - Using the conversion function on something other than
    command line arguments 
      doubtful - grepping the code doesn't reveal anything
  - The path refers to a location on some other server:
      doubtful - these would always be prefixed by something like
                 server:/path, right?
  - Sometimes we really want an absolute path and not its relative
    equivalent
      unsure - what for?

Here is a small catalog of commands that were modified:

  Convert absolute paths if prefixed by repodir:
    add, amend-record, annotate, changes, diff,
    mv, record, remove, replace, revert, whatsnew
  No actual changes, despite code modifications:
    apply, push, pull, put.

Also, the patch no longer attempts to canonicalise absolute paths, which
means that it might not work for all paths, but should  be good enough
for most of them.

What do the rest of you think?  Is this ok? 

Anyway, there is perhaps a simpler, less invasive solution to the
problem.  I'd certainly welcome somebody finding that instead :-)

Cheers,

Eric

================================================================

Fri Dec 30 01:54:24 CET 2005  Eric Kow <eric.kow at gmail.com>
  * Added --repodir argument to init (RT #104 and part of RT #196)
  
  This implementation also tries to create the repodir if it does not exist.
  

Fri Dec 30 03:16:52 CET 2005  Eric Kow <eric.kow at gmail.com>
  * --repodir argument for several commands (RT #196 and RT #559)
  
  Commands affected: dist, optimize, repair, replace, setpref, tag, trackdown
  
  Includes a small repodir test script.
      
  Note that wrt RT #196 
    * replace and setpref (marked "no need" in the bug report -- but I don't see why not)
    * changes (--repo)  untouched [ I'd suggest having both flags available ]
    * get (--repo-name) [ no reccomendations ]
  

Fri Dec 30 14:36:05 CET 2005  Eric Kow <eric.kow at gmail.com>
  * --repodir argument for get (RT #196 - controversial?)
  
  get already accepts a --repo-name flag, but I see no reason to keep this
  distinction, especially if we accept that init should accept --repodir
  
  In this implementation, we also keep the old --repo-name around for backwards
  compatability (of dubious value here), but the internal representation is
  changed to that of repodir
  

Mon Jan  9 01:12:24 CET 2006  Eric Kow <eric.kow at gmail.com>
  * --repodir for changes (RT #196 and #567)
  
  Changes already accepts a --repo flag for possibly remote repo dirs, but there
  is no reason not to also accept --repodir.  The gain in consistency outweighs
  the cost in redundancy.
     
  Also, do not attempt to get_repodir unless --repo is in the arguments.  This
  is so that --repodir can work with relative paths.  (Otherwise, darcs tries to
  change directory twice, which is bad).  
  
Sat Mar  4 03:41:50 CET 2006  Eric Kow <eric.kow at gmail.com>
  * Improved support for absolute paths (issue 32).
  
  This modifies fix_maybe_absolute so that if you specify a repository
  directory, any absolute paths prefixed by this directory are converted
  to be ones relative to the repodir.
  
  The following commands now account for arguments which are absolute
  paths but refer to files in the repository:
    add, amend-record, annotate, changes, diff,
    mv, record, remove, replace, revert, whatsnew
  
  The following commands are not actually affected, though the code 
  is changed: 
    apply, push, pull, put.
  
  This patch also slightly refactors FilePathUtils.lhs
 
Sat Mar  4 11:43:55 CET 2006  Eric Kow <eric.kow at gmail.com>
  * Enable tests for absolute paths.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-darcs-patch
Size: 46266 bytes
Desc: A darcs patch for your repository!
Url : http://lists.osuosl.org/pipermail/darcs-devel/attachments/20060304/385abe84/attachment.bin


More information about the darcs-devel mailing list