# HG changeset patch # User Jeff Hammel # Date 1321402675 28800 # Node ID 81fe0523a0782c268a2bbef18a8eaba7c5e42a1f # Parent c9f2311dedea584ff34b14c9d3ca20c7f7a23f0e documentation diff -r c9f2311dedea -r 81fe0523a078 README.txt --- a/README.txt Tue Nov 15 15:14:45 2011 -0800 +++ b/README.txt Tue Nov 15 16:17:55 2011 -0800 @@ -3,11 +3,18 @@ fetch stuff from the interwebs +`fetch.py `_ is +a single-file python module bundled as a +`package `_ for easy installation +and python importing. The purpose of fetch is to mirror remote +resources (URLs) to a local filesystem in order to synchronize and +update dependencies that are desired to be mirrored in this way. + Format ------ -`fetch` fetches from a manifest of the format:: +``fetch`` fetches from a manifest of the format:: [URL] [Destination] [Type] @@ -15,33 +22,82 @@ which is used to extract the subdirectories from a multi-directory resource. -The `Type` of the resource is used to dispatch to the included -Fetchers that take care of fetching the object. +The ``Type`` of the resource is used to dispatch to the included +Fetchers that take care of fetching the object. + +Manifests are used so that a number of resources may be fetched from a +particular ``fetch`` run. Fetchers -------- -`fetch` includes several objects for fetching resources:: +``fetch`` includes several objects for fetching resources:: file : fetch a single file tar : fetch and extract a tarball hg : checkout a mercurial repository git : checkout a git repository -The `file` fetcher cannot have a hash tag subpath since it is a single +The ``file`` fetcher cannot have a hash tag subpath since it is a single resource. -Though `fetch` has a set of fetchers included, you can pass an -arbitrary list into `fetch.Fetch`'s constructor. +Though ``fetch`` has a set of fetchers included, you can pass an +arbitrary list into ``fetch.Fetch``'s constructor. Version Control --------------- -The `hg` and the `git` fetchers fetch from version control systems and -have additional options. +The ``hg`` and the ``git`` fetchers fetch from version control systems and +have additional options. The only current option to the constructor +is ``export``, which is by default True. If ``export`` is True, then +the repository will be exported into a non-versioned structure. If a +subpath is specified with a ``#`` in the URL, the repository will also +be exported. + + +TODO +---- + + * use `manifestparser `_ + ``.ini`` files versus another manifest + format: when I started work on ``fetch``, I thought a + domain-specific manifest would be a big win. But, now, maybe a + ``.ini`` type manifest looks about the same, and is something that + is already used. The switch internally wouldn't be that bad, but + if ``fetch.py`` is used as a single file, it cannot have + "traditional" python dependencies. Since ``manifestparser.py`` is + also a single file, and ``fetch`` is only usable with internet + access anyway, maybe the + `require `_ + pattern could be used for this purpose + * clobber: generally, you will want the existing resource to be + clobbered, avoiding renames regarding upstream dependencies + + * outputting only subpaths: often, you will not to fetch from the + whole manifest, only from certain subpaths of the manifest. You + should be able to output a subset of what is to be mirrored based + on destination subpaths. The CLI option ``--dest`` is intended for + this purpose but currently unused. + + * fetcher options: + + * note python 2.5+ specifics: + +Unsolved Problems +----------------- + +A common story for ``fetch`` is mirroring files into a VCS repository +because the remote resources are needed as part of the repository and +there is no better way to retrieve and/or update them. However, what +do you do if these remote resources are altered? In an ideal +ecosystem, the fixes would be automatically triaged and triggered for +upstream inclusion, or the diffs from the upstream are kept in local +modifications (although vendor branches, etc, are more suitable for +the latter class of problems, and in general discouraged when a less +intrusive system of consuming upstream dependencies are available). ---- diff -r c9f2311dedea -r 81fe0523a078 example.txt --- a/example.txt Tue Nov 15 15:14:45 2011 -0800 +++ b/example.txt Tue Nov 15 16:17:55 2011 -0800 @@ -1,7 +1,7 @@ # example manifest for fetch -# URL DESTINATION TYPE -http://k0s.org/geekcode . file -https://github.com/mozilla/mozbase/tarball/master#mozprofile . tar -http://k0s.org/mozilla/hg/fetch#fetch.py . hg -git://github.com/mozautomation/mozmill.git#jsbridge jsbridge git +# URL DESTINATION TYPE +http://k0s.org/geekcode tmp/code file +https://github.com/mozilla/mozbase/tarball/master#mozprofile tmp/mozprofile tar +http://k0s.org/mozilla/hg/fetch#fetch.py tmp/fetch.py hg +git://github.com/mozautomation/mozmill.git#jsbridge tmp/jsbridge git diff -r c9f2311dedea -r 81fe0523a078 fetch.py --- a/fetch.py Tue Nov 15 15:14:45 2011 -0800 +++ b/fetch.py Tue Nov 15 16:17:55 2011 -0800 @@ -419,4 +419,3 @@ if __name__ == '__main__': main() -