Skip to content

Commit

Permalink
Important cleanup and foundation for snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Pierre committed Sep 30, 2009
1 parent 5105074 commit 78df128
Show file tree
Hide file tree
Showing 9 changed files with 236 additions and 590 deletions.
43 changes: 0 additions & 43 deletions Documentation/DESIGN.txt

This file was deleted.

281 changes: 0 additions & 281 deletions Documentation/sink-api.html

This file was deleted.

69 changes: 0 additions & 69 deletions MANUAL.txt

This file was deleted.

62 changes: 62 additions & 0 deletions README
@@ -0,0 +1,62 @@
== Sink
== Swiss army knife for directory comparison and synchronization
-- Author: Sébastien Pierre <sebastien@type-z.org>
-- Revision: 1.0.0 (29-Sep-2009)


Use cases
=========

Changes mode
============

Linking mode ('-l' options)
===========================

Sink's '-l' mode comes in handy when you'd like to use symlinks but you can't
(because you put your files under revision control, etc).

Let's put this in context: let's say you're just began working on a new Web application
('mywebapp') and that you start by using a couple of files ('reset.css',
'base.css', 'sidebarlayout.css') from your 'mycsslibs' project.

You'll probably simply copy the files to 'mywebapp', but if you update them in
'mywebapp' you'll have to propagate back the changes to 'mycsslib', and you
might forget to do so.

You might also just create symlinks instead of copying the files -- but your SCM
system is likely to consider the file as a symlink, so your 'mywebapp' will
depend on having 'mycsslibs' installed at the right location.

Using Sink '-l' mode you can have most of the advantages of symlinks, while
making it easy to propagate and merge back changes.

Let's take a tour of the options, assuming 'mywebapp' and 'mycsslibs' are
located in the '~/Projects' directory:

First we'll create a Sink link database:

> cd ~/Projects/mywebapp ; sink -l init

we then create the links to the css files we want to borrow from 'mycsslibs':

> sink -l add ~/Projects/mycsslib/base.css .
> sink -l add ~/Projects/mycsslib/mycsslibs.css .
> sink -l add ~/Projects/mycsslib/sidebarlayout.css .

now you can check the status of your links (did you do local changes, did the
original file changed ?)

> sink -l status

you can pull changes from the source (meaning updating the 'mywebapp' CSS files
according to the 'mycsslibs' files)

> sink -l pull

or push your local changes to the source (meaning updating the 'mycsslibs' CSS files
according to the 'mywebapp' local version)

> sink -l push

# EOF - vim: ts=2 sw=2 textwidth=80 et syn=kiwi
139 changes: 0 additions & 139 deletions Resources/epydoc.css

This file was deleted.

26 changes: 13 additions & 13 deletions Sources/sink/linking.py
Expand Up @@ -7,12 +7,12 @@
# License : BSD License (revised)
# -----------------------------------------------------------------------------
# Creation date : 23-Jul-2007
# Last mod. : 20-Sep-2007
# Last mod. : 29-Sep-2009
# -----------------------------------------------------------------------------

# TODO: Make it standalone (so it can be intergrated into Mercurial Contrib)

import os, sys, sha, stat, getopt, shutil
import os, sys, hashlib, stat, getopt, shutil

#------------------------------------------------------------------------------
#
Expand Down Expand Up @@ -227,13 +227,13 @@ def __str__( self ):
Available operations are:
link init Initializes a link database for a specific folder
link add Creates a link between two file
link remove Removes a link between two files
link status Gives the status of linked files
link update Updates the linked files
-l init Initializes a link database for a specific folder
-l add Creates a link between two file
-l remove Removes a link between two files
-l status Gives the status of linked files
-l update Updates the linked files
sink link init [PATH]
sink -l init [PATH]
Initialises the link database for the current folder, or the folder at the
given PATH. If PATH is omitted, it will use the current folder, or will look
Expand All @@ -242,7 +242,7 @@ def __str__( self ):
There are no options for this command.
sink link add [OPTIONS] SOURCE DESTINATION
sink -l add [OPTIONS] SOURCE DESTINATION
Creates a link from the the SOURCE to the DESTINATION. The DESTINATION must
be contained in a directory where the 'link init' command was run.
Expand All @@ -251,14 +251,14 @@ def __str__( self ):
-w, --writable Link will be made writable (so that you can update it)
sink link status [PATH|LINK]...
sink -l status [PATH|LINK]...
Returns the status of the given links. If no link is given, the status of
all links will be returned. When no argument is given, the current
directory (or one of its parent) must contain a link database, otherwise
you should give a PATH containing a link databae.
sink link update [OPTIONS] [PATH|LINK]...
sink -l update [OPTIONS] [PATH|LINK]...
Updates the given links in the current or given PATH, or updates only the
given list of LINKs (they must belong to the same link DB, accessible from
Expand All @@ -275,7 +275,7 @@ def __str__( self ):
-f, --force Forces the update, ignoring local modifications
-m, --merge Uses the $MERGETOOL to merge the link source and dest
sink link remove LINK [LINK..]
sink -l remove LINK [LINK..]
Removes one or more link from the link database. The links destinations
won't be removed from the filesystem unlesse you specify '--delete'.
Expand Down Expand Up @@ -535,7 +535,7 @@ def _readLocal( self, path ):
return c

def _sha( self, content ):
return sha.new(content).hexdigest()
return hashlib.sha1(content).hexdigest()

def _mtime( self, path ):
"""Returns the modification time of the file at the give path."""
Expand Down

0 comments on commit 78df128

Please sign in to comment.