Subversion Control - svn

subversion stores all versioned data in a central repository.

assume I got a Qt project in /home/czhang/project1

firstly, create a repository:
$ mkdir /home/czhang/svn
$ svnadmin create /home/czhang/svn/repos
$ ls /home/czhang/svn/repos
conf/ dav/ db/ format hooks/ locks/ README.txt

import project folder into repository:
$ svn import ~/project1 file:///home/czhang/svn/repos/project1 -m "initial import"

now the repository contains all 'project1' files. I won't see these files in /home/czhang/svn/repos, they are all stored within a database.
Note that the original /home/czhang/project1 directory is unchanged. Subversion is unaware of it. (in fact, i can even delete that directory if i wish.) To start manipulating repository data, I need to create a new "working copy" of the data, a sort of private workspace.

$ svn checkout file:///home/czhang/svn/repos/project1 ~/svn_project

now I have a personal copy of part of the repository in a new directory name "svn_project".
I can edit Qt project from this folder and then commit those changes back to the repository.

!!! in Qt, make sure in "Projects" tag --- "Build Settings" --- "General": un-tick "Shadow build". 
otherwise, project will be built in wrong directory.

To reverse back to older version project, close this project, and go to the personal project folder which I am working in. Use command:
$ svn info                ; check version information
$ svn co up -r 1       ; reverse back to version 1
$ svn up -r 1            ; if it has already been checked out

Then use svn over ssh to checkout all program files to another pc (eg. server)

$  svn co svn+ssh://czhang@ /build/czhang/qt-everywhere-opensource-src-4.7.0/projects/m4_arm

!!! remember, all resource files only can be put into
    otherwise, it won't compile for arm processor
    if there isn't a "projects" folder, create one.

go to folder "m4"
$ qmake
$ make
arm-linux-g++ -c -pipe -fno-exceptions -O2 -Wall -W -D_REENTRANT -D_TTY_POSIX_ -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../mkspecs/qws/linux-arm-g++ -I. -I../../../include/QtCore -I../../../include/QtNetwork -I../../../include/QtGui -I../../../include -I/home/czhang/Downloads/qextserialport -I.moc/release-shared-emb-arm -I.uic/release-shared-emb-arm -o .obj/release-shared-emb-arm/mainscr.o mainscr.cpp
In file included from mainscr.cpp:7:
globleVar.h:6:28: error: qextserialport.h: No such file or directory
In file included from mainscr.cpp:7:
globleVar.h:49: error: expected initializer before ‘*’ token
mainscr.cpp: In member function ‘void MainScr::on_pushButton_clicked()’:
mainscr.cpp:108: error: ‘serialPort’ was not declared in this scope
mainscr.cpp: In member function ‘void MainScr::openSerialPort()’:
mainscr.cpp:136: error: ‘serialPort’ was not declared in this scope
mainscr.cpp:136: error: expected type-specifier before ‘QextSerialPort’
mainscr.cpp:136: error: expected `;' before ‘QextSerialPort’
mainscr.cpp:144: error: ‘BAUD115200’ was not declared in this scope
mainscr.cpp:145: error: ‘PAR_NONE’ was not declared in this scope
mainscr.cpp:146: error: ‘FLOW_OFF’ was not declared in this scope
mainscr.cpp:147: error: ‘DATA_8’ was not declared in this scope
mainscr.cpp:148: error: ‘STOP_1’ was not declared in this scope
mainscr.cpp: In member function ‘void MainScr::strSend(QString)’:
mainscr.cpp:156: error: ‘serialPort’ was not declared in this scope
mainscr.cpp: In member function ‘QString MainScr::strReceive()’:
mainscr.cpp:162: error: ‘serialPort’ was not declared in this scope
make: *** [.obj/release-shared-emb-arm/mainscr.o] Error

take a look
$ gedit

# Project created by QtCreator 2010-08-04T16:44:30

QT       += core gui


    mainscr.cpp \
    main.cpp \
    cyclescrdialog.cpp \
    engscrdialog.cpp \
    manopdialog.cpp \
    globleVar.cpp \

    mainscr.h \
    cyclescrdialog.h \
    engscrdialog.h \
    manopdialog.h \
    globleVar.h \

FORMS    += \
    mainscr.ui \
    cyclescrdialog.ui \
    engscrdialog.ui \
    manopdialog.ui \

LIBS += -lqextserialport
INCLUDEPATH += /home/czhang/Downloads/qextserialport

at the last line, the path of qextserialport is still in old directory. change it to be:

INCLUDEPATH += /build/czhang/qt-everywhere-opensource-src-4.7.0/projects/qextserialport

$ make clean
$ make
arm-linux-g++ -Wl,-rpath-link,/build/czhang/qt-everywhere-opensource-src-4.7.0/lib -fno-exceptions -Wl,-O1 -Wl,-rpath,/usr/lib -Wl,-rpath,/usr/lib -o m4 .obj/release-shared-emb-arm/mainscr.o .obj/release-shared-emb-arm/main.o .obj/release-shared-emb-arm/cyclescrdialog.o .obj/release-shared-emb-arm/engscrdialog.o .obj/release-shared-emb-arm/manopdialog.o .obj/release-shared-emb-arm/globleVar.o .obj/release-shared-emb-arm/pwdialog.o .obj/release-shared-emb-arm/moc_mainscr.o .obj/release-shared-emb-arm/moc_cyclescrdialog.o .obj/release-shared-emb-arm/moc_engscrdialog.o .obj/release-shared-emb-arm/moc_manopdialog.o .obj/release-shared-emb-arm/moc_pwdialog.o    -L/build/czhang/qt-everywhere-opensource-src-4.7.0/lib -lqextserialport -lQtGui -L/build/czhang/qt-everywhere-opensource-src-4.7.0/lib -lQtNetwork -lQtCore -lpthread
/build/czhang/overo-oe/tmp/sysroots/x86_64-linux/usr/armv7a/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: cannot find -lqextserialport
collect2: ld returned 1 exit status
make: *** [m4] Error 1

add lib path:
$ gedit

LIBPATH += /build/czhang/qt-everywhere-opensource-src-4.7.0/projects/qextserialport/build

after that, use following command to check your program:
$ readelf -a m4 | less

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1

program m4 is in ARM format.

Next time, after I commit a new version of program, I just need to use 'svn up' to checkout.
$ cd /build/czhang/qt-everywhere-opensource-src-4.7.0/projects/m4_arm
$ svn up

No comments:

Post a Comment