[PATCH 0 of 2] Proposals for additions to "paths" functionality

Victor Suba vosuba at gmail.com
Sun Nov 13 14:31:50 CST 2011


For your review, submitting implementations for parts 1 and 2 of my prior
proposal with the goal of making a named path alias always available.


1)  Add per-repository paths stored in the repo that can be operated on via "hg paths"
    command while keeping compatibility with the "hgrc" paths configurations.
    
    Add .hg/paths file for storing list of path NAME URL pairs.

    New commands (in addition to current "paths" functionality):
        hg paths [-f] [-d] [-m NAME] [NAME] [URL]
        
        -f --force          force
        -d --delete         delete a given path alias
        -r --rename NAME    rename a given path alias
        
        You can use "hg paths NAME URL" to create the path alias NAME to the
        URL.  Add -f to force change an existing path alias.
        
        To delete a path alias use "hg -d NAME".
        
        To rename an existing path alias use "hg -r CURRENT_NAME NEW_NAME".
        
        Paths already defined in local or global "hgrc" files can't be changed or deleted
        via these commands, and "hgrc" paths take priority over .hg/paths.

2)  Make path alias available as a namespace for bookmarks when cloned/pulled from
    a remote repo.

    If a URL is directly used in clone or pull or push, all paths are reverse checked
    for a match to get the matching path alias.
    
    If no existing paths are matched, a unique alias is assigned of the form
    "remote<N>" and saved automatically in .hg/paths, thereby repeated use of a URL
    will map to the same alias, which will be visible in "hg paths".
    
    Whenever a path in "hgrc" is used, the path is also mirrored in .hg/paths, so
    a remote path alias that has been used in a command won't be forgotten without
    explicitly running "hg paths -d NAME".  This gives opportunity for hooking some
    extra functionality when a remote path is deleted, such as garbage collecting
    orphaned bookmarks.


More information about the Mercurial-devel mailing list