IMPORTANT!

Snipt is going open source. We've toyed with this idea for quite a while, and have finally decided it's the right way to move forward.

A few things:
  • The entire Snipt source code will be released on GitHub under the 3-clause BSD License on Friday, September 10th.
  • While we'd like to think we're perfect, we realize we're only human. By open sourcing the software that runs this website, certain bugs or security flaws may be discovered that could compromise the privacy of your snipts.
  • Only the Lion Burger team will be able to push commits to the Snipt.net site. Contributors should send a pull request to add new features or submit patches.
  • By using this site, you agree not to be too angry or take any legal action against Lion Burger should this whole thing go up in flames some day.
  • Follow us on Twitter for updates.
I agree, close this message
Sign up to create your own snipts, or login.

Latest 100 public snipts » subversion The latest public subversion snipts.

showing 1-20 of 35 snipts for subversion
  • Subversion command to change repo
    svn switch --relocation http://existing/url to http://new/url
    

    copy | embed

    0 comments - tagged in  posted by timsloan on May 11, 2010 at 12:57 a.m. EDT
  • Ignore a directory with Subversion
    $ svn propset svn:ignore directory_name .
    
    OR
    
    $ svn propedit svn:ignore .
    

    copy | embed

    0 comments - tagged in  posted by buithehoa on Apr 18, 2010 at 9:05 p.m. EDT
  • fix and release revisions for svn:externals entries
    #!/usr/bin/env python
     
    """
    runs from the local directory and fixes or releases all svn:externals.
    """
     
    import sys
    import os
    import re
    
    REVISION_CACHE = {}
    URL_ROOT_CACHE = {}
     
    def is_subversion_path(path):
        return os.path.exists(os.path.join(path, '.svn'))
    
    def svn_repository_root(url):
        if not URL_ROOT_CACHE.has_key(url):
            p = os.popen("svn info %s" % url)
            repository_info = p.read()
            p = re.compile("Repository Root: (?P<root>.*)")
            m = p.search(repository_info)
            if not m:
                raise """repository root of [%s] could not be determined""" % url
            URL_ROOT_CACHE[url] = m.group('root')
        return URL_ROOT_CACHE[url]
    
    def svn_head_revision(url):
        repository_root = svn_repository_root(url)
        if not REVISION_CACHE.has_key(repository_root):
            p = os.popen("svn log --revision HEAD %s" % repository_root)
            latest_log_entry = p.read()
            p = re.compile("r(?P<revision>\d+) \|")
            m = p.search(latest_log_entry)
            if not m:
                raise """revision of [%s] could not be determined""" % repository_root
            REVISION_CACHE[repository_root] = int(m.group('revision'))
        return REVISION_CACHE[repository_root]
    
    def svn_propdget_svnexternals(path):
        '''fetch the svn:externals property of given path'''
        if is_subversion_path(path):
            p = os.popen("svn propget svn:externals '%s'" % path)
            data = p.read().strip()
            p = re.compile("(?P<local>\S+)( -r(?P<revision>\d+))? (?P<target>.*)")
            return [(m.group('local'), m.group('revision'), m.group('target').strip()) for m in p.finditer(data)]
        
    def svn_propset_svnexternals(path, value):
        '''set the svn:externals property of the given path'''
        os.popen("""svn propset svn:externals '%s' %s """ % ( value, path)).read()
        
    class SvnExternalsEntry:
        def __init__(self, externals_property):
            (self.local, self.revision, self.target) = externals_property
            
        def current_head_url(self):
            """the svn:externals entry pointing to the latest (highest) revision at the target repository"""
            self._head()
            return """%(local)s -r%(head)s %(target)s""" % self.__dict__
    
        def trunk_url(self):
            """the svn:externals entry pointing to no revision (trunk) at the target repository"""
            return """%(local)s %(target)s""" % self.__dict__
            
        def _head(self):
            if not hasattr(self, 'head'):
                self.head = svn_head_revision(self.target)
            
        def __str__(self):
            head = ""
            if hasattr(self, 'head'):
                head = """ (HEAD: [%s])""" % self.head
            return ("""external reference to [%(target)s] mounted at [%(local)s] in revision [%(revision)s]""" % self.__dict__) + head
        
    class SvnExternalsEntryHolder:
        def __init__(self, path):
            self.path = path
            self._externals()
            
        def has_externals(self):
            return self.externals != None
        
        def fix(self):
            svn_propset_svnexternals(self.path, '\n'.join([e.current_head_url() for e in self.externals]))
    
        def release(self):
            svn_propset_svnexternals(self.path, '\n'.join([e.trunk_url() for e in self.externals]))
            
        def list(self):
            [self.__print(e) for e in self.externals]
    
        def list_head(self):
            for e in self.externals:
                e._head()
                print e
    
        def __print(self, arg):
            print arg
    
        def _externals(self):
            externals_properties = svn_propdget_svnexternals(self.path)
            if externals_properties:
                self.externals = [SvnExternalsEntry(externals_property) for externals_property in externals_properties]
            else:
                self.externals = None
            
        def __str__(self):
            return """entry at [%s] with [%d] svn:externals""" % (self.path, len(self.externals))
     
    def main():
        if len(sys.argv) < 2 or not sys.argv[1] in ('fix', 'release', 'list', 'list-head'):
            print 'Usage: %s fix|release|list|list-head' % sys.argv[0]
            sys.exit()
            
        operation = sys.argv[1]
           
        entries = []
        root_dir = os.getcwd()
        sys.stdout.write("""scanning directory tree at [%s] for svn:externals properties""" % root_dir)
        for root, dirs, files in os.walk(root_dir):
            for dir in dirs:
                absolute_path = os.path.join(root, dir)
                sys.stdout.write('.')
                sys.stdout.flush()
                see = SvnExternalsEntryHolder(absolute_path)
                if see.has_externals():
                    sys.stdout.write('+')
                    entries.append(see)
                    
        print """done. [%d] entries found.""" % (len(entries))
        for entry in entries:
            if operation == "fix":
                print """fixing [%s]...""" % entry
                entry.fix()
            elif operation == "release":
                print """releasing [%s]...""" % entry
                entry.release()
            elif operation == "list":
                print """listing [%s]...""" % entry
                entry.list()
            elif operation == "list-head":
                print """listing with head information [%s]...""" % entry
                entry.list_head()
    
     
    if __name__ == '__main__':
        main()
    

    copy | embed

    0 comments - tagged in  posted by da_chrisch on Apr 24, 2009 at 9:08 a.m. EDT
  • bashrc aliases for svn add all and svn delete all
    alias svnaddall='svn status | grep "^\?" | awk "{print \$2}" | xargs svn add'
    alias svndelall='svn status | grep "^\!" | awk "{print \$2}" | xargs svn delete'
    

    copy | embed

    0 comments - tagged in  posted by nick on Mar 31, 2009 at 7:45 p.m. EDT
  • create subversion patch
    svn diff > ~/fix_ugly_bug.diff
    

    copy | embed

    0 comments - tagged in  posted by nick on Mar 27, 2009 at 1:31 p.m. EDT
  • apply svn patch
    patch -p0 -i ~/fix_ugly_bug.diff
    

    copy | embed

    0 comments - tagged in  posted by nick on Mar 11, 2009 at 9:37 p.m. EDT
  • show subversion updates to be applied before running svn update
    svn status --show-updates
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 05, 2009 at 12:35 a.m. EST
  • commit working copy changes to subversion
    svn commit -m 'adding cvs checkout of image module from drupal.org'
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 05, 2009 at 12:34 a.m. EST
  • run svn status on working copy
    svn status
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 05, 2009 at 12:34 a.m. EST
  • checkout subversion project into working copy
    svn checkout file:///path/to/repos/name-of-project/trunk name-of-destination-directory/
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 05, 2009 at 12:32 a.m. EST
  • import directory as a new project into a subversion repository
    svn import name-of-folder file:///path/to/repos -m 'First Import'
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 05, 2009 at 12:26 a.m. EST
  • create a subversion repository from the command line
    svnadmin create repos
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 05, 2009 at 12:26 a.m. EST
  • add subversion package installation to path
    PATH=~/path/to/installation/bin
    export PATH
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 05, 2009 at 12:25 a.m. EST
  • configure subversion package installation
    ./configure --prefix=/path/to/installation
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 05, 2009 at 12:24 a.m. EST
  • extract subversion dependencies
    tar -xzvf subversion-deps-1.4.5.tar.gz
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 05, 2009 at 12:22 a.m. EST
  • extract subversion package
    tar -xzvf subversion-1.4.5.tar.gz
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 05, 2009 at 12:21 a.m. EST
  • download subversion dependencies
    wget http://subversion.tigris.org/downloads/subversion-deps-1.4.5.tar.gz
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 05, 2009 at 12:19 a.m. EST
  • download subversion package
    wget http://subversion.tigris.org/downloads/subversion-1.4.5.tar.gz
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 05, 2009 at 12:17 a.m. EST
  • how to run dry-run of a subversion merge
    svn merge svn+ssh://user@domain.com/path/to/repos/project-x/trunk svn+ssh://user@domain.com/path/to/repos/project-x/tags/REL-1-0-1 --dry-run
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 04, 2009 at 11:42 p.m. EST
  • how to switch to a separate subversion tag
    svn switch svn+ssh://user@domain.com/path/to/repos/project-x/tags/REL-1-0-1
    

    copy | embed

    0 comments - tagged in  posted by nick on Feb 04, 2009 at 11:41 p.m. EST
Sign up to create your own snipts, or login.