Archive

Posts Tagged ‘svn’

Git basic

September 7, 2011 Leave a comment

I’m a noob in using Git, and I’m using Github to host some of the code I wrote. Here are some basic commands to host a project with Github (or using Git revision control generally) (sometimes I forgot the command or the order of which command goes first)

Global setup:

Set up git

git config --global user.name "Your Name"
git config --global user.email myemail@maildomain.com

Next steps:

mkdir project-name
cd project-name
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@github.com:username/project-name.git
git push -u origin master

Existing Git Repo?

cd existing_git_repo
git remote add origin git@github.com:username/project-name.git
git push -u origin master

To commit changes (and optionally push changes to Github)

git add .
git commit -m 'commit message'
git push -u origin master

Common SVN users may find it confusing when using Git. Here’s some of the tips:

  • There are no centralized server or repo. You are the server / repo
  • In SVN, what’s in your computer is working copy and the center for committing changes is the repository, In Git, your working copy is your repository.
  • In SVN, project members checked out a working copy and commit changes to a centralized repository. In Git, everyone in a project can be the repository, can checkout (pull) and commit (push) changes to each other
    (Note: In Git, ‘checkout’ is called `pull`, ‘commit’ is saving changes to your own repository, ‘push’ is sending and merging changes to remote repository
Categories: Notes Tags: , ,

Trac on Fedora

November 6, 2010 Leave a comment

This is multiple projects installation, a continuation from previous posts.

Install required packages:

yum install trac mod_wsgi

Software: Trac 0.11.7, mod_wsgi 2.3

Trac folder: /var/svn/trac
Python eggs cache dir: /tmp/egg-cache

Create new trac environment

trac-admin /var/svn/trac/testproj initenv
  Project Name > Test Project
  Database connection string > [sqlite:db/trac.db]
  Repository type > [svn]
  Path to repository > /var/svn/repos/testproj

Create wsgi script

vim /var/svn/trac/trac.wsgi
#!/usr/bin/env python
import os
def application(environ, start_request):
  os.environ['TRAC_ENV_PARENT_DIR'] = '/var/svn/trac'
  os.environ['PYTHON_EGG_CACHE'] = '/tmp/egg-cache'
  from trac.web.main import dispatch_request
  return dispatch_request(environ, start_request)

Apache mod_wsgi settings

vim /etc/httpd/conf.d/trac.conf
# comment all settings in /etc/httpd/conf.d/wsgi.conf
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /trac /var/svn/trac/trac.wsgi
<Directory /var/svn/trac>
  WSGIApplicationGroup %{GLOBAL}
  Order deny,allow
  Allow from all
</Directory>
<LocationMatch "/trac/[^/]+/login">
  AuthType Digest
  AuthName "Project Repository"
  AuthUserFile /var/svn/auth
  Require valid-user
</LocationMatch>

Grant administration right to admin user (trac>=0.11)

trac-admin /var/svn/trac/testproj permission add user1 TRAC_ADMIN

Set ownership

chown -R apache.apache /var/svn

Reload apache

service httpd reload

View list of projects - http://localhost/trac

Categories: Notes Tags: , , , ,

Apache + SVN on Fedora

November 6, 2010 1 comment

Create SVN repo, accessible from network, all users can read & checkout, certain users can write / commit

Software: Apache 2.2.11, Subversion 1.6.6, mod_dav_svn 1.6.6

File & folder:

/var/svn/
/var/svn/auth – authentication file
/var/svn/repos/ – project repositories

Install mod_dav_svn

yum install mod_dav_svn svn

Create SVN repo (refer previous post)

svnadmin create --fs-type fsfs /var/svn/repos/testproj

Create authentication file

htdigest [-c] <auth file> <realm> <username>
htdigest -c /var/svn/auth "Project Repository" user1

c – create file (exclude this flag when adding users)

Setup Apache + mod_dav_svn

vim /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

<Location /svn>
  DAV svn
  SVNParentPath /var/svn/repos
  SVNListParentPath On
  AuthType Digest
  AuthName "Project Repository"
  AuthUserFile /var/svn/auth
  <LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
  </LimitExcept>
</Location>

Change ownership of the whole svn repo dir

chown -R apache.apache /var/svn

Note: Re-assign the ownership everytime you create a new repo

Lastly, reload apache

service httpd reload

View list of projects – http://localhost/svn
View contents of particular (myproj) project – http://localhost/svn/myproj

Categories: Notes Tags: , , ,

Using SVN

November 6, 2010 2 comments

My notes on how to use subversion from command line.

Assumptions:

Project dir: ~/Projects/myproj
SVN temp layout dir: /tmp/svn
SVN repos: /var/svn/repos

Create repo

mkdir -p /var/svn/repos
svnadmin create --fs-type fsfs /var/svn/repos/myproj

Import project

svn import <local dir> <repo>
mkdir -p /tmp/svn/trunk /tmp/svn/tags /tmp/svn/branches
svn import /tmp/svn file:///var/svn/repos/myproj -m "Initial import" 
svn import ~/Projects/myproj file:///var/svn/repos/myproj/trunk -m "Initial project import"

for local repo – file:/// …
for network repo – http:// …

Check out

svn checkout|co <repo> [working copy]
svn checkout file:///var/svn/repos/myproj ~/Projects/myproj
svn co file:///var/svn/repos/myproj/trunk
# will auto checkout to folder 'myproj' in current dir
# that folder is called 'working copy' dir

Review changes

svn status
# in working copy dir

Add files

svn add <folder|file>

Delete file/folder

svn delete <folder|file>
svn delete file:///var/svn/repos/myproj/trunk/file.txt 
# also can delete file in repo, not only in working copy

Commit

svn commit -m "Log message"
# in working copy dir

Update

svn update (in working copy dir)

Tagging projects

svn copy <repo> <repo tag dir>
svn copy file:///var/svn/repos/myproj/trunk file:///var/svn/repos/myproj/tags/0.1 -m "Version 0.1"

Export (for release)

svn export <repo>
svn export file:///var/svn/repos/myproj/tags/0.1
# will export to folder 'myproj'  in current dir
Categories: Notes Tags:

Subversion on thumbdrive

March 26, 2010 Leave a comment

This post shows how to create a Subversion (SVN) repo on a thumbdrive. I don’t know what’s the minimum capacity of thumbdrive should be used, but 2GB seems enough (mine’s 8GB)

Software to use: RabbitVCS

There are 3 parts, download all parts (Core, Nautilus & GEdit plugin), and install them

  • Select all 3 packages, right click > Open with Package Installer

Assumptions:

  • the repo folder on thumbdrive is referred as /media/thumbdrive/project_repo
  • project folder is ~/project/my_project (folder contains your work)

Create new repository:

  1. Create a folder (for repo) on thumbdrive (/media/thumbdrive/project_repo)
  2. Go inside that folder, right click > RabbitVCS > Create repository here
  3. Create temporary folder (~/tmp) and create repo layout inside:
    • ~/tmp/trunk
    • ~/tmp/branches
    • ~/tmp/tags
  4. Import repo layout into repo inside the thumbdrive:
    • Select ~/tmp > right click > RabbitVCS > Import
    • Repository: file:///media/thumbdrive/project_repo
    • enter import message, and OK
  5. Import project folder into repo inside the thumbdrive:
    • Select ~/project/my_project, right click > RabbitVCS > Import
    • Repository: file:///media/thumbdrive/project_repo/trunk
    • enter message, and OK

Check out repo into another computer

Assuming this another computer running Windows, it should have TortoiseSVN installed.
Note: c:\users\username is referred as ~\ in this post, repo folder in thumbdrive is e:\project_repo

  1. Go to project folder (folder which your keep all your project files, e.g. ~\projects)
  2. Right click > SVN Checkout
  3. URL of repository: file:///E:/project_repo/trunk
  4. Checkout directory – make sure it is ~\projects, then OK
Categories: Notes Tags: , , ,
Follow

Get every new post delivered to your Inbox.