Version Control with Subversion: Tortoise SVN – III

Hello All, I am here again with some more SVN commands which you may like or which may help you, while using SVN for any app :).

This is the continuous part of Version Control with Subversion and the previous two are listed below.

1 – Version Control with Subversion: Tortoise SVN
2 – Version Control with Subversion: Tortoise SVN – II

This time, we will check some more SVN useful commands, and let’s jump into the SVN sea, without wasting our time :-D.

svn diff <Old File Path> <New File Path>

This plays a big role in SVN commands and while managing the code. This command helps to display the differences between two revisions or paths, so that developers can check what has been changed by any other developer or by herself/himself with effect to different dates.

Options
1. -r [--revision] ARG -> ARG (some commands also take ARG1:ARG2 range), a revision argument can be NUMBER(revision number), DATE(revision at start of the date), HEAD(latest in repository), BASE(base rev of item’s working copy), COMMITTED(last commit at or before BASE), PREV(revision just before COMMITTED)
2. -c [--change] ARG -> The change made by revision ARG (like -r ARG-1:ARG). If ARG is negative this is like -r ARG:ARG-1
3. --old ARG -> Use ARG as the older target
4. --new ARG -> Use ARG as the newer target
5. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
6. --diff-cmd ARG -> Use ARG as diff command
7. --internal-diff -> Override diff-cmd specified in config file
8. -x [--extensions] ARG -> Default: ‘-u’. -u (–unified), -b (–ignore-space-change), -w (–ignore-all-space), –ignore-eol-style(Ignore changes in EOL style), -p (–show-c-function).
9. --no-diff-deleted -> Do not print differences for deleted files
10. --show-copies-as-adds -> Don’t diff copied or moved files with their source
11. --notice-ancestry -> Notice ancestry when calculating differences
12. --summarize -> Show a summary of the results
13. --changelist [--cl] ARG -> Operate only on members of changelist ARG
14. --force -> Force operation to run
15. --xml -> Output in XML
16. --git -> Use git’s extended diff format

svn revert <File Name>

As the name implies, it reverts/undo all the local changes or it also used to resolve any file in conflicted state.

Options
1. --targets ARG -> Pass contents of file ARG as additional args
2. -R [--recursive] -> Descend recursively, same as –depth=infinity
3. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
4. -q [--quiet] -> Print nothing, or only summary information
5. --changelist [--cl] ARG -> Operate only on members of changelist ARG

svn resolve <File Path>

This command is helpful to resolve conflicts on the files or directories.

Options
1. --targets ARG -> Pass contents of file ARG as additional args
2. -R [--recursive] -> Descend recursively, same as –depth=infinity
3. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
4. -q [--quiet] -> Print nothing, or only summary information
5. --accept ARG -> Specify automatic conflict resolution source (‘base’, ‘working’, ‘mine-conflict’, ‘theirs-conflict’, ‘mine-full’, ‘theirs-full’)

svn cleanup <File Path>

This command is required to cleanup the working copy recursively. Mainly, it is needed when the working copy has been locked, while any issues/conflicts.

Options
1. --diff3-cmd ARG -> Use ARG as merge command

svn merge <Source File Path> <Target File Path>

This command is used to merge the differences between source files to a working copy path. If anyone will not provide target file path, then the changes will be applied to the current working directory.

Options
1. -r [--revision] ARG -> ARG (some commands also take ARG1:ARG2 range), a revision argument can be NUMBER(revision number), DATE(revision at start of the date), HEAD(latest in repository), BASE(base rev of item’s working copy), COMMITTED(last commit at or before BASE), PREV(revision just before COMMITTED)
2. -c [--change] ARG -> The change made by revision ARG (like -r ARG-1:ARG). If ARG is negative this is like -r ARG:ARG-1
3. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
4. -q [--quiet] -> Print nothing, or only summary information
5. --force -> Force operation to run
6. --dry-run -> Try operation but make no changes
7. --diff3-cmd ARG -> Use ARG as merge command
8. --record-only -> Merge only mergeinfo differences
9. -x [--extensions] ARG -> When Subversion is invoking an external diff program, ARG is simply passed along to the program. But when Subversion is using its default internal diff implementation, or when Subversion is displaying blame annotations, ARG could be -u (–unified), -b (–ignore-space-change), -w (–ignore-all-space), –ignore-eol-style, -p (–show-c-function).
10. --ignore-ancestry -> Ignore ancestry when calculating merges
11. --accept ARG -> Specify automatic conflict resolution action (‘postpone(p)’, ‘working’, ‘base’, ‘mine-conflict(mc)’, ‘theirs-conflict(tc)’, ‘mine-full(mf)’, ‘theirs-full(tf)’, ‘edit(e)’, ‘launch(l)’)
12. --reintegrate -> Merge a branch back into its parent branch
13. --allow-mixed-revisions -> Allow merge into mixed-revision working copy. Use of this option is not recommended! Please run ‘svn update’ instead.

Ohh!! that’s a lot guys 🙂 … We went through almost all the basic commands, that could be required, on SVN usage. We listed all the options for each command, which could be possible with the main command.

In my next blog, we will go through the process of creating project, managing the project with the commands, we already went through. So, STAY TUNED for my next blog, that will cover some more commands. Hope you will like this blog.

Thanks 🙂 and will be happy to listen from you 🙂 :).

Version Control with Subversion: Tortoise SVN – II

Hello everyone, I am back again with your demand for SVN commands. This time, we will go through all usual commands which may be needed while using SVN :).

So, let’s not waste our time, and let’s go and check the commands one by one :).

svn help

The name itself suggests ‘HELP’. Yes, it will assist the new/old user to use SubVersion. There are a lot more subcommands like checkout, commit, update, add, blame, revert, relocate, resolve, … etc., which can be used with svn help like svn help <subcommand> to get individual brief details for that subcommand.

svn ls <URL of Repo> OR svn list <URL of Repo>

This command will list all the directories or files list, in the repository.

Options
1. -r [--revision] ARG -> ARG (some commands also take ARG1:ARG2 range), a revision argument can be NUMBER(revision number), DATE(revision at start of the date), HEAD(latest in repository), BASE(base rev of item’s working copy), COMMITTED(last commit at or before BASE), PREV(revision just before COMMITTED)
2. -v [--verbose] -> Print extra information
3. -R [--recursive] -> Descend recursively, same as –depth=infinity
4. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
5. --incremental -> Give output suitable for concatenation
6. --xml -> Output in XML

svn co <URL of Repo> OR svn checkout <URL of Repo>

This command will checkout a working copy from the given repository.

Options
1. -r [--revision] ARG -> ARG (some commands also take ARG1:ARG2 range), a revision argument can be NUMBER(revision number), DATE(revision at start of the date), HEAD(latest in repository), BASE(base rev of item’s working copy), COMMITTED(last commit at or before BASE), PREV(revision just before COMMITTED)
2. -q [--quiet] -> Print nothing, or only summary information
3. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
4. --force -> Force operation to run
5. --ignore-externals -> Ignore externals definitions

svn up <URL of Repo> OR svn update <URL of Repo>

This command will help to update the working copy, which will finally sync with the Subversion repository.

Options
1. -r [--revision] ARG -> ARG (some commands also take ARG1:ARG2 range), a revision argument can be one of NUMBER(revision number), DATE(revision at start of the date), HEAD(latest in repository), BASE(base rev of item’s working copy), COMMITTED(last commit at or before BASE), PREV(revision just before COMMITTED).
2. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
3. --set-depth ARG -> set new working copy depth to ARG (‘exclude’, ’empty’, ‘files’, ‘immediates’, or ‘infinity’)
4. -q [--quiet] -> Print nothing, or only summary information
5. --diff3-cmd ARG -> Use ARG as merge command
6. --force -> Force operation to run
7. --ignore-externals -> Ignore externals definitions
8. --changelist [--cl] ARG -> Operate only on members of changelist ARG
9. --editor-cmd ARG -> Use ARG as external editor
10. --accept ARG -> Specify automatic conflict resolution action (‘postpone(p)’, ‘working’, ‘base’, ‘mine-conflict(mc)’, ‘theirs-conflict(tc)’, ‘mine-full(mf)’, ‘theirs-full(tf)’, ‘edit(e)’, ‘launch(l)’)
11. --parents -> Make intermediate directories

svn add <File Name>

This command will help to add files or directories, subdirectories or symlinks to repositories.

Options
1. --targets ARG -> Pass contents of file ARG as additional args
2. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
3. -q [--quiet] -> Print nothing, or only summary information
4. --force -> Force operation to run
5. --no-ignore -> Disregard default and svn:ignore property ignores
6. --auto-props -> Enable automatic properties
7. --no-auto-props -> Disable automatic properties
8. --parents -> Add intermediate parents

svn delete <File Name>

This will help user to delete an item from working copy or working repository.

Options
1. --force -> Force operation to run
2. -q [--quiet] -> Print nothing, or only summary information
3. --targets ARG -> Pass contents of file ARG as additional args
4. -m [--message] ARG -> Specify log message ARG
5. -F [--file] ARG -> Read log message from file ARG
6. --force-log -> Force validity of log message source
7. --editor-cmd ARG -> Use ARG as external editor
8. --encoding ARG -> Treat value as being in charset encoding ARG
9. --with-revprop ARG -> Set revision property ARG in new revision using the name[=value] format
10. --keep-local -> Keep path in working copy

svn copy <From File Path> <To File Path>

This command is required to copy a file or directory in a working copy or in the repository. It needs to paths as argument, one is from file path and another is to file path.

Options
1. -r [--revision] ARG -> ARG (some commands also take ARG1:ARG2 range), a revision argument can be NUMBER(revision number), DATE(revision at start of the date), HEAD(latest in repository), BASE(base rev of item’s working copy), COMMITTED(last commit at or before BASE), PREV(revision just before COMMITTED)
2. -q [--quiet] -> Print nothing, or only summary information
3. --ignore-externals -> Ignore externals definitions
4. --parents -> Make intermediate directories
5. -m [--message] ARG -> Specify log message ARG
6. -F [--file] ARG -> Read log message from file ARG
7. --force-log -> Force validity of log message source
8. --editor-cmd ARG -> Use ARG as external editor
9. --encoding ARG -> Treat value as being in charset encoding ARG
10. --with-revprop ARG -> Set revision property ARG in new revision using the name[=value] format

svn move <From File Path> <To File Path>

This command is used to move one file or item from one place to another in a working copy or repository. This is purely equivalent to first copy the file content from one place to another and then delete the file from where copy content has been made.

Options
1. -r [--revision] ARG -> ARG (some commands also take ARG1:ARG2 range), a revision argument can be NUMBER(revision number), DATE(revision at start of the date), HEAD(latest in repository), BASE(base rev of item’s working copy), COMMITTED(last commit at or before BASE), PREV(revision just before COMMITTED)
2. -q [--quiet] -> Print nothing, or only summary information
3. --force -> Force operation to run
4. --parents -> Make intermediate directories
5. -m [--message] ARG -> Specify log message ARG
6. -F [--file] ARG -> Read log message from file ARG
7. --force-log -> Force validity of log message source
8. --editor-cmd ARG -> Use ARG as external editor
9. --encoding ARG -> Treat value as being in charset encoding ARG
10. --with-revprop ARG -> Set revision property ARG in new revision using the name[=value] format

svn status <File Path>

This command is used to print the status of working copy files and directories.

Options
1. -u [--show-updates] -> Display update information
2. -v [--verbose] -> Print extra information
3. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
4. -q [--quiet] -> Don’t print unversioned items
5. --no-ignore -> Disregard default and svn:ignore property ignores
6. --incremental -> Give output suitable for concatenation
7. --xml -> Output in XML
8. --ignore-externals -> Ignore externals definitions
9. --changelist [--cl] ARG -> Operate only on members of changelist ARG

😎 … Really interesting ones!!! 🙂 There are a lot of options available for each and every SVN commands, and which will make a programmer’s life much easier than not using any SubVersion mechanism.

But, there are still some more commands we have, which will be helpful while dealing with one project/application. So, STAY TUNED for my next blog, that will cover some more commands. Hope you will like this blog.

Thanks 🙂 and will be happy to listen from you 🙂 :).

Version Control with Subversion: Tortoise SVN

The word Version Control represents Revision Control or Source Control, which ultimately specify to control the source code, by managing multiple revisions of the same unit of information.

In simple words, we can say, Version Control System is a software that helps software developers to work together and also maintains complete history of their work by keeping all the work as per version.

Then, what is Subversion … 😕 …

Actually, Subversion is a free or open source version control system (VCS). That is, Subversion manages files and directories and it keeps the record of all the changes made to any file/folder. It keeps all the older revisions as history to examine the code in later time or to check how the data has been changed.

Apache Subversion which is often abbreviated as SVN, is a software versioning and revision control system distributed under an open source license.

Understood something … 🙂 nice 😎 … Let’s check the brief advantages of using it :).

Advantages :-
– Allow developers to work simultaneously.
– Centralized the code.
– Maintain complete history of all developers work.
– Do not overwrite each others changes.
– Enables collaboration between developers.
– Backup and restore the code.
– Short term and long term code revert.

There are a lot more advantages, which you will innovate while using SVN :P.

So, let’s check some terminology of SVN in rough manner.

Repository :-
Repository is a central location in which data is stored and managed. It is the heart/central part of any Version Control System. It keeps all the files, folders, history of data. It can be accessed over a network, as it will be stored in a central position. Repository acts as a server and version control tool acts as client. SVN client can connect to repository over network and can get/set the changes from/to repository, so that the latest changes will be visible to other developer/user by updating the changes.

Trunk :-
It is the main body of development. Generally, it is a directory where all the main development happens and that’s why is usually checked out by developers to work on the project.

Tags :-
Tags are markers to highlight notable revisions in the history of the repository. Usually it will be a point in time on the trunk or a branch that you wish to preserve. We mainly create tags to keep a preservation of a major release. This is the most stable point of the software before major revisions on the trunk were applied.

Branches :-
A branch will be a copy of code or side-line of development derived from a certain point to make larger, experimental, major changes to the code while preserving the untouched code in the trunk. If the major changes, experiment work according to plan, then they can be merged back to the trunk. Other developer can take an update of the working copy and can get the latest code.

SVN Commit :-
Commit means committing/saving the changes into repository. All users need to commit the changes he/she made to the code to make it available for other user.

SVN Update :-
Update means getting the latest data from repository. It brings changes from the repository into your working copy, so that you will get the latest changes made by any user. If we provide any revision number, then it brings the code till that revision, what committed. If no revision is given, it brings your working copy up to date with the HEAD revision.

SVN Log :-
It shows committed log messages from the repository. It will list the details of the committed files with comments, with date and time, when it got committed.

SVN Revert :-
Revert means, to go back to the previous step/stage what already have been accomplished. It reverts any local changes made to a file or directory, property changes made to any folder and it also resolves any conflicted state.

SVN Cleanup :-
It recursively clean up the working copy, removing locks from the working copy and resuming unfinished operations. If for some reason, a Subversion command cannot complete successfully, perhaps due to server problems, then working copy will get locked, then clean up command is necessary to unlock the process.

SVN Switch :-
Generally, switch means, relocating to any other place. Here, SVN switch update working copy to a different URL. If developer is currently on one branch, and done with the changes what has been asked for, then after committing the current branch, developer can now switch to the trunk or any other branch.

SVN Merge :-
SVN merge apply the differences between two sources to a working copy path. It is used to merge the specified files into the trunk so that the latest changes would be overwritten into the trunk, but then need to commit the changes on trunk, to be reflected for other users.

SVN Import :-
The svn import is a quick way to copy an unversioned tree of files into a repository, creating intermediate directories as necessary. SVN import doesn’t require a working copy, and the files are immediately committed to the repository.

 

Hmmm… We went through some of the terminology which is essential to know while using SVN.

So, please say, should we now use any of the Version Control or not to manage the code :-|.

If we got the points and advantages of using SVN, then :cool:, we are all set and now Ready … Steady … Go …… with Subversion :D.

Thanks 🙂 and will be happy to listen from you 🙂 :).