SVN use tutorial

Source: Internet
Author: User
Tags log log svn client svn update ultraedit version control system tortoisesvn tortoisesvn download

SVN use tutorial

Profile

Overview

Since 2011-7-10, SAE will fully support SVN code deployment, and users can deploy code not only from any SVN client, but also to the SVN repository of the application, even if they do not use SVN client deployment code, and the code version is guaranteed.

such as: Through the online Code Editor (http://sdk.tools.sinaapp.com), such as the modification of the code, deployment, and so on, like SVN commit, a new version is generated. The most recent update can be obtained via SVN client svn update, or the code can be rolled back through the SVN client.

SVN warehouse address : Https://svn.sinaapp.com/your_app_name(You can access directly from this address)

For example: The application domain name is test.sinaapp.com, then the SVN warehouse address is: https://svn.sinaapp.com/test

SVN user name : SAE Secure mailbox

svn password : SAE Security Password (if the micro shield dynamic password is enabled, fill in the "Security password" + "Micro Shield dynamic password" here)

Note: SVN username and password for secure mailbox and security password, not Weibo account and Weibo password!

The difference from standard SVN

To maintain compatibility with SAE, the use of SVN to deploy code to the SAE has the following limitations:

1, the file name or directory name is not allowed to contain the following characters: ", *,?, <,>,|, and also the beginning and end of the file or filename is not allowed to have spaces.

2, upload a single file size not more than 20M

3, the number of files in a single directory can not exceed 2000

4, the total size of each application code does not exceed 100M

5, the total size of a single version of the code does not exceed 50M

6. Only 10 versions are allowed in the AppName directory, and the version number must be a positive integer. (That is, only 10 positive integer directory names are allowed under AppName, and non-directories are not allowed)

How code is deployed

The SAE code deployment is divided into three steps:

Create an App

When you log in to the SAE online management platform and create a new app (Http://sae.sina.com.cn/?m=myapp&a=create), an SVN repository is automatically created for the app if it is created successfully. Assuming that the newly created app is named Newapp, the warehouse address is:

https://svn.sinaapp.com/newapp/

At this point, the local working directory of the app can be checked out via the local SVN client (checkout).

Deployment Code

The SAE provides different ways of deploying code, which can be divided into two categories:

One is through the SVN client deployment, which is the recommended code deployment method for SAE.

The other is installed through a non-SVN client deployment, the online Code online editor and the recommended application.

These two types of code deployment methods update the SVN repository version of the app, but it's important to note that the non-SVN client deployment does not provide version management functionality, only the latest version of the code, or the rollback of the code.

Therefore, it is strongly recommended to use only SVN client way to deploy the code, if the use of non-SVN client mode deployment, in order to avoid code version conflict, in time to do the SVN update operation in the local SVN working directory, to ensure that the local working directory and online code consistency.

Verify

After the code has been updated, see if the code has been updated to the line via SVN update or by accessing the app directly from the browser.

Related Resources

TortoiseSVN Download: http://tortoisesvn.net/downloads.html

Subversion Chinese Station: http://www.subversion.org.cn/

Windows SVN

Using the TORTOISESVN Client

It is recommended to use the Turtle (Tortoise) SVN client under Windows. TortoiseSVN is a free open source client of Subversion version control system that can manage files and directories beyond the time. Files are saved in the central repository (the SAE Central SVN repository), and the repository is very much like a normal file server in addition to remembering every modification of files and directories. You can restore files to a previous version, and you can check the history to see what changes were made to the data and who made the changes. That's why many people regard Subversion and version control systems as a "time machine."

Download installation

TortoiseSVN Download: http://tortoisesvn.net/downloads.html

Not under Linux, the installation is not much to say:)

The following is a detailed introduction to using TORTOISESVN to deploy code to the SAE.

Create a local working directory

The first step, 1, creates a new folder as a local working directory (working directory), and you can use the app name as the folder name. For example, create a local working directory for my app DevCenter.

The second step, check out from the SAE SVN Warehouse (Checkout) An app full version code, 2, right-click "SVN Checkout"

In the pop-up page, fill in the warehouse path, here is: https://svn.sinaapp.com/devcenter/, other default parameters, 3:

Reversion, "HEAD revision" refers to the latest version, or you can specify revision as any version.

Click "OK", the Download interface appears, 4:

If all goes well, devcenter apply all version code will appear in the DevCenter folder just created, 5:

Modify Code

Use your favorite editor locally, edit any file, save the file icon will appear red exclamation mark, 6:

Look, the index.php has just changed color. The following is a commit (commit) of the latest update. Right click on the index.php file, the menu appears,

Select "SVN Commit", 7:

Then fill in the log message about this update, which is required, otherwise the commit will fail. 8:

When you see 9, it shows that the modification has been successfully submitted, and the SVN version number of the previous DevCenter project is added to 1, which becomes 30.

Add Files/Folders

In the SVN working directory, for file modification, only a commit is required after completion, but for new files, or files or folders copied from other directories, you need to do a step add before commit, to add files or folders to the SVN working directory, Otherwise the SVN client does not recognize it. The operation is very simple, 10:

And then 7, right-click Commit.

For more tortoise svn use Help, please see: http://www.subversion.org.cn/tsvndoc/

notepad++ Integrated SVN plugin

notepad++ is a popular free open source code Editor in a Windows environment with a wealth of third-party plugins.

The following is an introduction to the installation and use of notepad++ 's SVN plugin.

12, click Plugin-Plugin Manager--Show Plugin Manager

After opening, on the "Available" page, locate "Subversion" and click "Install", 13:

After successful installation, the Subversion submenu appears under the Plugins menu.

Open any file you checkout down before, such as devcenter/1/index.php, after editing, click Plugins----------------or use the shortcut key Ctrl+alt+a

A familiar page appears, as shown in 14:

Yes, this is the Turtle SVN commit page, enter the log Message, click "OK" to submit.

Deploy with UltraEdit Studio

UltraEdit Studio (Note that not ultraedit,ultraedit cannot be integrated with SVN) is a bit more complicated to configure.

The first step, SVN warehouse account settings, 15:

Then fill in the warehouse information, 16 shows:

When you are finished, create project,17 as shown:

After completing the project name B.PRJ, the "Project Settings" appears in 18, click "Add Folder", "NewFolder" appears, remove the "Group" tick, then click "Browse" in the "Browse for Folder page to find the local working directory that appeared before checkout.

After clicking "OK" the prompt appears, 19 shows:

Indicates that Uestudio automatically identified the selected code directory is an SVN working directory, and asked if the integration, click "Yes", appears 20:

When you're done, "Close" can then edit the code and commit the changes at any time. 21 is shown below:

Deploying with EditPlus

EditPlus relies on Tortoise SVN (TSVN), which must be installed first.

The simplest use is shown in Figure 22:

When you edit the files in the SVN working directory, file--and tsvn appear with the corresponding actionable menu.

Linux/mac SVN

Warehouse Address

https://svn.sinaapp.com/appname/

For transport security, the SAE requires uniform deployment of code using HTTPS;

Create a warehouse

Login to the SAE online management platform (http://sae.sina.com.cn) to create your app, and you can check out the app code once it's successful.

For example, you have just created an app Newapp, which executes locally:

SVN checkout Https://svn.sinaapp.com/newapp

First time checkout need to verify, username/password for your SAE security mailbox and security password (non-Weibo login password, such as the micro-shield dynamic password has been enabled, then fill in the "Security password" + "Micro Shield Dynamic Password").

Create version

If you create version 1 for the Newapp app

Currently available in two different ways:

Using the SVN client

SVN checkout Https://svn.sinaapp.com/newapp #此处需要认证, username/password for your SAE secure mailbox and Secure password (if the micro shield dynamic password is enabled, fill in the "Security password" + "Micro Shield dynamic password" here)

CD Newapp

mkdir 1

SVN add 1

SVN commit-m "Add version 1 for Newapp"

Using the online management platform

Create a version in the SAE online management platform "code management". However, in order to avoid conflicts with the local warehouse, be sure to do this in the local working directory: SVN update, pull the latest update to local.

Update code

Before updating the code, you must have a working directory (working directory), and creating a working directory is simple, just check out (checkout) the Code warehouse. For example, for an application that has already been created, Newapp is executed locally:

SVN checkout Https://svn.sinaapp.com/newapp

Enter the security account and secure password to complete the creation of the local working directory.

Upload Code

You need to add a file or folder, such as deploying WordPress to version 1.

SVN checkout Https://svn.sinaapp.com/newapp

CD NEWAPP/1

cp-rf/path/to/wordpress/*./

SVN Add./*

SVN commit-m "Add WordPress"

Modify Code

If you need to modify a file in the Newapp application version 1 root directory, such as index.php, the complete operation flow is as follows:

SVN checkout Https://svn.sinaapp.com/newapp #如果已经checkout过了, no need to re-checkout.

CD NEWAPP/1

Vim index.php #这里编辑代码

SVN commit-m "Edit index.php"

Configuration app (AppConfig)

Under Application version root, such as NEWAPP/1, create file Config.yaml (syntax see: http://sae.sina.com.cn/?m=devcenter&catId=193), and then via SVN Commit to complete the application configuration.

For example, you now need to update the appconfig of the default version 3 of the app Newapp, as follows:

SVN checkout Https://svn.sinaapp.com/newapp #如果已经checkout过了, no need to re-checkout.

CD NEWAPP/3

Vim Config.yaml #这里按照config. YAML syntax editing.

SVN commit-m "Update Config.yaml"

Note: Config.yaml will not be deployed to the user's code directory, but will be stored in the server SVN repository. So the next time can be checkout out, but will not be accessed by the user.

Edit Code Online

SVN can read the app code online, the address is SVN warehouse address: https://svn.sinaapp.com/appname/

Switch appname to your app name to log in to see the code.

Online editor can be opened in Admin Panel >> code Management >> Edit code

SVN for SAE restriction conditions

To maintain compatibility with SAE, the use of SVN to deploy code to the SAE has the following limitations:

1, the file name or directory name is not allowed to contain the following characters: ", *,?, <,>,|, and also the beginning and end of the file or filename is not allowed to have spaces.

2, upload a single file size not more than 4M

3, the number of files in a single directory can not exceed 400

4, the total size of each application code does not exceed 100M

5, the total size of a single version of the code does not exceed 50M

6. Only 10 versions are allowed in the AppName directory, and the version number must be a positive integer. (That is, only 10 positive integer directory names are allowed under AppName, and non-directories are not allowed)

Common error description and solutions

Error hints
Cause of error
Workaround

The change log need some words (not null)
Log message not added when submitting
Add log message when submitting

The log message is a pathname (was-f intended?); Use '--force-log ' to override
Log message is the same as the path name
Modify the log message

Error file xxx in not allowed in root directory!
A file named xxx is not allowed in the root directory of working copy (only a positive integer version directory)
Delete the file or move to the version directory

Directory xxx/is not allowed in root directory! Only positive integer dirs is allowed!

A directory named XXX is not allowed in the root directory of working copy (only a positive integer version directory)
Delete the directory or move to the version directory

Too many versions! (less than permited)
Version directory more than 10, up to a maximum of 10
Delete the version directory you just created.

Too many files:xxx (less than are allowed).
The number of files in the XXX directory exceeds 2000
Delete files under the XXX directory to reduce the total to less than 2000

Dir appname/dir (size:xxxx) is too large less than xxx
The total size of the app under code (excluding. SVN directory) is more than 100M, or the total size of a version exceeds 50M
Remove unnecessary code and try to commit

File XXX is too large! (less than 4M)
Single file size more than 4M
Delete Retry

Similar to Repository uuid ' 305daf1b-94be-48ee-a4b9-f4bcd36320de ' doesn ' t match expected UUID ' 44e2f7a2-1b69-4710-974a-b6edef0fdc12 '
The server-side repository is deleted and rebuilt, and the client operates on the original warehouse.
Re-checkout a copy of the code to

Add vers xxx Faild
File deployment failed
For internal reasons, please contact [email protected].

Common SVN command description

1. Retrieve the code from the SVN repository to the working copy:

# svn checkout https://svn.sinaapp.com/appname [workcopy]

Where workcopy is optional, WORKCOPY,SVN will default to appname as Workcopy if not written.

If you only retrieve a version:

# svn checkout https://svn.sinaapp.com/appname/appversion [workcopy]

To retrieve only one version of a directory:

# svn checkout Https://svn.sinaapp.com/appname/appversion/folder [workcopy]

2. Submit code to SVN repository:

# SVN commit-m "Here is the message"

3. Add local files to the working copy:

# SVN add something

Note: If something is a file, SVN will add the file to the working copy, and if something is a directory, SVN will add the directory and all the files inside it to the working copy. Something can also be a wildcard *, which ignores files that have already been added.

4. Delete a file from the working copy:

# SVN Delete Something

Note: If something is a file, SVN will delete the file from the working copy, and if something is a directory, SVN will delete the directory and all of its files from the working copy.

5. Delete files directly from the SVN repository:

# svn delete-m "delete Something" https://svn.sinaapp.com/appname/appversion/something

Note: You can delete a single file or a single directory or even a version directly from the SVN repository.

6. Import a local project to the SVN repository:

To import a version of an app:

# SVN import Localdir https://svn.sinaapp.com/appname/appversion

Note: To ensure that the currently applied appversion does not conflict.

7. View the status of files or directories in your working copy:

# SVN status [something]

8. Update your working copy:

# SVN update

Note: Download the latest version from the SVN repository, this command will cause the locally uncommitted changes to be lost, and it is recommended to check the local copy status (SVN status) before using this command.

9. Cancellation of Code modification

There are two cases of canceling the modification of the code.

The first case: The change was not committed (commit).

In this case, the previous modification can be canceled using SVN revert.

The SVN revert usage is as follows:

# svn revert [-r] Something

Where something can be a relative path (either a directory or a file) or an absolute path.

When something is a single file, the direct svn revert something is OK, and when something is a directory, it needs to add the parameter-R (Recursive, recursion), otherwise it will only change the directory of something.

In this case, you can also use the SVN Update command to cancel the previous modification, but it is not recommended. Because SVN update is going to connect to the warehouse server, it's time consuming.

Note: The SVN revert itself is inherently dangerous because it is intended to discard uncommitted modifications. Once you have chosen recovery, Subversion has no way to retrieve uncommitted modifications.

The second case: The change has been committed (commit). In this case, use the SVN merge command to roll back.

The procedure for rolling back is as follows:

1) Make sure we get the latest code:

SVN update

Suppose the latest version number is 28.

2) then find out the exact version number to roll back:

SVN log [something]

Assume that the version number to rollback is 25 based on the SVN log log, where the something can be a file, a directory, or an entire project

If you want to know more about the situation, you can use SVN diff-r 28:25 [something]

3) Roll back to version number 25:

SVN merge-r 28:25 Something

For insurance purposes, confirm the results of the rollback again:

SVN diff [something]

Found correct, submit.

4) Commit rollback:

SVN commit-m "Revert revision from R28 to R25,because of ..."

The post-commit version becomes 29.

Summarize the above actions as follows: three

A. SVN update,svn log, find the latest version (latest revision)

B. Find the version number you want to roll back (Rollbak revision)

C. Roll back with svn merge: SVN merge-r: something

10. View SVN repository log information:

# SVN log [workcopy]

View all local history logs, if Workcopy is a file, then view the log information for a file.

View log information for all SVN repository files:

# SVN log https://svn.sinaapp.com/appname/

This command will look at all the modified logs.

Note: The SVN service provided by SAE fully supports all of the standard SVN commands, and for more detailed instructions please refer to the SVN official Help documentation.

SVN command Help documentation: http://www.subversion.org.cn/svnbook/1.4/svn.ref.html

Chinese full help document: http://svnbook.red-bean.com/index.zh.html


The source of this article http://www.cnblogs.com/jx270/archive/2013/03/04/2943595.html

Copyright NOTICE: Welcome reprint, Hope in your reprint at the same time, add the original address, thank you with

SVN use tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.