Android Tutorial SVN (source control) and Basic4android

Erel

Administrator
Staff member
Licensed User
Large projects and especially projects maintained by a group of developers usually require a source control system.
Using SVN with Basic4android is quite straightforward with a client tool such as TortoiseSVN. If you are familiar with SVN then the only thing you should remember is to add the Objects folder to svn:ignore as this folder holds temporary files and builds created during compilation.

If you are completely new to SVN then I recommend you to start by reading some material about SVN. A very good tutorial is available here: Version Control with Subversion

In this tutorial we will set a local SVN server and manage a project using TortoiseSVN client.

SVN is made of two main components. The server and the clients.
The server can be installed locally or on a different computer.
VisualSVN is the recommended SVN server for windows. It is easy to manage and is free.
Download and install VisualSVN.

Download and install TortoiseSVN. This is the client (it is also free).
The installation requires restarting Windows. So be patient...

We will now add the CurrencyConverter project to SVN.
You can add a different project in a similar manner. Please backup your project before adding it.
Run VisualSVN.
Create a new repository named 'main', with the default layout.
Create a new user.

Under the trunk folder create a folder named CurrencyConverter.



In VisualSVN right click on CurrencyConverter and choose Copy URL to clipboard.

Open Windows Explorer and navigate to your project folder.
Right click and choose SVN Checkout.
Paste the URL in the repository field.
Make sure that the checkout directory is correct and doesn't include the project name twice.



If this is the first time you connect with the local server then you will see a warning message about the certificate. Press on the Accept Permanently button.

After the checkout all the project files and folders should appear with a question mark icon as they are missing from the repository.



The next step is to add the Objects folder to the 'ignore' list. The Objects folder should not be controlled as it only* contains files generated during compilation (*the icon file is also stored inside. In order to keep things simple I recommend you to manage the icon manually).

Right click on Objects folder and choose Add to ignore list:


Now we should add the code files and the Files folder to SVN.
Mark these items and choose Add:


Right click on CurrencyConverter folder and choose SVN Commit to commit the changes:



The result should look like:



This means that the code files and Files folder are updated, and Objects is ignored.

Your project is now managed by SVN :icon_clap:

SVN is very powerful and will allow you to easily track changes and compare the current version with previous versions. It is your responsibility to commit your changes from time to time.

If users are interested with auto-committing the project every x hours then I will explain how to accomplish it with an additional script.
 

moster67

Expert
Licensed User
Very nice Erel. Great TIP!

Just got some free time to set it up. It works very nice. I just love the diff-viewer.

If would be great if one could execute the SVN-commit command from within B4A.
 
Last edited:

Penko

Active Member
Licensed User
Let me continue the question.

First of all, great tutorial, you explain everything in a very straightforward way.

My question is, imagine that me and my partner are working simultaniously, what is the behavior of B4A? I open a new project, setup SVN and do the following:
- add activity 1
- add activity 2
- add activity 3

Then my partner adds activity 4.

What I suppose is that I will see this activity the next time I open the project in B4A. But what if he does some changes to the three activities I've added. Will I see them?

I am asking because we may be writing a program in a team. It's still an idea but may happen and I have to do some researching in advance.
 

Erel

Administrator
Staff member
Licensed User
This is exactly the purpose of SVN. It shows you and lets you easily synchronize updates done by other members. Whether these are new files or existing files.
 

Penko

Active Member
Licensed User
But is it dynamic? If we are working simultaniously without reopening the project, will b4a update the project so if I click the tab my partner has worked on, will I see the changes instantly? I am not sure how the IDE handles files, so that's why I am asking.

Sent from my HTC Desire using Tapatalk
 

Erel

Administrator
Staff member
Licensed User
No. You will need to first use the SVN update feature and then reopen the project.
 

mjtaryan

Active Member
Licensed User
I've never used SVN but it sounds quite useful, especially in a collaborative environment. What also would be nice would be to have a release tracker that would work with the IDE and compiler. We had an in house pre-compiler that did this. It would look through the sourcecode and note changes, store the files in a repository and increment the version number subordinates automatically. Only the actual version had to be incremented specifically. Our version numbering had the format of Version.Major Changes (new or major rewrites of secitons of code).Minor Changes (typo/spelling corrections, minor rewrites) -- a number would like XX.yyy.zzz with only the bolded portion being updated automatically. If B4a had this system, upon exiting it would replace the version string with the new release number.
 

Sathish VM

Member
Licensed User
I've installed both VisualSVN server and TortoiseSVN client and managing my source code. It works fine in my office. My Server settings are as per the image below. INLN50846751a.sap.corp is my full computer name and sap.corp is the domain I'm connected to, in office.


However, when I use this at home, I am unable to either update my files in windows explorer or Commit. It gives an error. I am also not able to browse to VisualSVN content using the link https://inln50846751a.sap.corp/svn/main in the browser at home. However in office, this link works just fine and I'm able to see the files in browser, and also able to upload/commit using explorer just fine.

I'm wondering it has got something to do with the fact that my computer is not "in the domain" at home, but its connected to office network and in the domain at office.

May I request help in making SVN work at my home too?
 

Erel

Administrator
Staff member
Licensed User
This seems like a network problem. How are you connecting to the office computer?
 

Sathish VM

Member
Licensed User
[quote="Erel, post: 208854] How are you connecting to the office computer?[/quote]

I have only one computer and it is password protected Windows 7. So i enter my user/pwd to login. Visual SVN does not worK at home even if the computer is standalone and not connected to any network, at home. Does this answer your questi on?
 

Erel

Administrator
Staff member
Licensed User
Is VisualSVN installed on your home computer? If not then how should the home computer connect to it?
 

Erel

Administrator
Staff member
Licensed User
Yes. Though you can use any other version control solutions as well.
 

vecino

Well-Known Member
Licensed User
Hello, what other similar software that complements B4A.
For Windows XP :rolleyes:
 

JTmartins

Active Member
Licensed User
for some reason TortoiseSVN 1.9.3, Build 27038 - 64 Bit , 2015/12/13 11:53:16 does not apear to be working as the tutorial under Win10.

I'm new into this, so I will digg further, to see if I can understand this tool.

Many thanks Erel.
 
Last edited:

inakigarm

Well-Known Member
Licensed User
@JTmartins, are you still in problems with Tortoise ?? I want to implement a subversion system with TortoiseSVN and my environment is similar to yours.
 
Top