这两天响应老板要求,把所有代码放到公司的SVN服务器上,按照我的想法肯定是就苹果组建一个服务器,然后内部版本控制,自带的Xcode就有这个功能,之前也这么做过,但是xcode4.X系列SVN还是很好用,自从升级到Xcode5之后还没弄过。今天试了一下午还是没完全明白,眼看弄不出来,就直接用命令行了,不过一些简单的东西还是试出来了。

1.如何使用Xcode5  SVN从公司服务器 check out项目

  1. Choose Source Control > Check Out.

  2. Select the repository you want to check out, and click Next.

    You can select your repository from the Repositories tab, the Favorites tab, or the Recents tab. If you know the location of the repository you want to check out, you can also enter the address manually.

  3. If Xcode is unable to automatically identify the trunk and branches, use the browser window to select the correct project location, and click Next.

  4. In the Checkout window, select the branches and working copies to check out, and click Next.

    You will be presented only with the necessary options for your repository. If your project contains only one working copy, you will only have to select the branch to checkout. If your project doesn’t contain branches, you will only be given an option of working copies to checkout. If you project is a single working copy with no branches, this dialog will be skipped entirely.

  5. Select the location to store the working copy, and click Check Out.

2.当有修改时,在Source Control里面可以做点什么,我试了下commit,可以提交到本地,但是没有提交到服务器,中间包括-1012错误,然后配置git用户名跟邮箱。然后填写版本注释,然后就提交,看似提交成功,服务器上却没有。

3.Push local changes:我点击了试试,就出来下面这个,我有点疑惑,后来发现人家是

push local changes to a remote git repository

然后我就有点怀疑,难道Xcode自带的SVN的subversion类型不支持提交到服务器这个功能么。

然后看帮助文档,有这么一句。

If you’re using Subversion, a commit operation copies the changes from selected files into the remote Subversion repository. Therefore, you must be connected to the repository before you can commit changes. (For details, see your repository administrator.)

搞了半天不懂 see your repository administrator是什么意思。翻译出来是库管理员。我只想说看他有个毛用。我自能默默自嘲英文差。

4.然后我就想着再继续往下看。Updating or Pulling Changes from a Repository

如何更新和提交更改。然后就看到下面的内容。

Update your project with changes from the repository using the Source Control menu.

  • For a Git repository, choose Source Control > Pull.

  • For a Subversion repository, choose Source Control > Update.

  • For a project that contains both Git and Subversion repositories, choose Source Control > Update and Pull.

For projects with multiple repositories, select the ones you want to update.

Resolve differences by using the left and right buttons to specify which file’s contents to use.

After reconciling all differences, click Pull (Git) or Update (SVN) to complete the operation.

打开Source Control就没有找到Pull和Update。本来就英文差,他妈的刚巧就认得这几句,然后就此作罢。大牛莫要嘲笑我,还请告知我是哪里出了问题。

看了一个问答,XCODE5中怎么上传到SVN服务器,老外给出的结论是:两个办法,一个是用svn client,客户端软件;另一个方法是命令行。One way is using an svn client. The one which is obviously available is the command line svn client.

http://stackoverflow.com/questions/18894195/xcode-5-export-project-to-svn-repository

但是事情不能不做,就在网上找了命令实验了一下,尽可能写的详细点,下次看的时候好懂。随便帮帮跟我一样正在郁闷的人。

1.更改配置(不懂的话就直接跳过吧)

bogon:~ chenshuangchou$ open ~/.subversion/config

启动配置文件,然后在配置文件中选择要忽略的文件类型

找到 global-ignores 一行,去掉注释,编辑成

global-ignores = build *~.nib *.so *.pbxuser *.mode *.perspective*

# global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo

找到 enable-auto-props = yes 把注释去掉,在[auto-props] Section声明以下文本文件

*.mode* = svn:mime-type=text/X-xcode

*.pbxuser = svn:mime-type=text/X-xcode

*.perspective* = svn:mime-type=text/X-xcode

*.pbxproj = svn:mime-type=text/X-xcode

2.import命令

首先将本地代码import到版本库

bogon:~ chenshuangchou$ svn import /Users/chenshuangchou/Desktop/BuickIOS/Buickhousekeeper  https://192.168.21.248:8443/svn/BuickIOS/ -m "initial import"

3.checkout命令

然后从版本库checkout出来,这个目录就相当于被激活,内部跟服务器地址关联。

bogon:~ chenshuangchou$svn checkout https://192.168.21.248:8443/svn/BuickIOS/ /Users/chenshuangchou/Desktop/BuickIOS

4.add命令

当有新增的文件时用add指令,增加到版本库,然后提交

svn add /Users/chenshuangchou/Desktop/BuickIOS/Buickhousekeeper/ViewControllers/CarViewController/FuelManageViewController/lastmouth_color1.png

执行这条指令的前提是/Users/chenshuangchou/Desktop/BuickIOS/是从服务器checkout下来的目录,也就是is a working copy

新增成功的话会有

A  (bin) Desktop/BuickIOS/Buickhousekeeper/ViewControllers/CarViewController/FuelManageViewController/lastmouth_color1.png

5.commit命令

提交内容到版本库

bogon:~ chenshuangchou$ svn commit -m "添加了一个油耗柱状图" /Users/chenshuangchou/Desktop/BuickIOS/Buickhousekeeper/ViewControllers/CarViewController/FuelManageViewController/lastmouth_color1.png

提交到版本库成功的话,

Adding  (bin) Desktop/BuickIOS/Buickhousekeeper/ViewControllers/CarViewController/FuelManageViewController/lastmouth_color1.png

Transmitting file data .

Committed revision 3.

6.update命令

更新版本库到本地,更新指定目录,svn update如果后面没有目录,默认将当前目录以及子目录下的所有文件都更新到最新版本。

bogon:~ chenshuangchou$ svn update /Users/chenshuangchou/Desktop/BuickIOS1

更新成功

Updating 'Desktop/BuickIOS1':

A   Desktop/BuickIOS1/Buickhousekeeper/ViewControllers/CarViewController/FuelManageViewController/lastmouth_color1.png

Updated to revision 3.

回退到版本2:

bogon:~ chenshuangchou$ svn update -r 2 Desktop/BuickIOS1/

回退成功的话

Updating 'Desktop/BuickIOS1':

D   Desktop/BuickIOS1/Buickhousekeeper/ViewControllers/CarViewController/FuelManageViewController/lastmouth_color1.png

Updated to revision 2.

冲突

(更新,于版本库同步。如果在提交的时候提示过期的话,是因为冲突,需要先update,修改文件 ,然后清除svn resolved ,最后再提交commit)

在提交时发生版本冲突会怎么样

bogon:~ chenshuangchou$ svn commit -m "在delegate中加入了一句话" /Users/chenshuangchou/Desktop/BuickIOS/

Sending        Desktop/BuickIOS/.git/index

Sending        Desktop/BuickIOS/Buickhousekeeper/AppDelegate.h

Sending       Desktop/BuickIOS/Buickhousekeeper.xcodeproj/project.xcworkspace/xcuserdata/chenshuangchou.xcuserdatad/UserInterfaceState.xcuserstate

Transmitting file data ...

Committed revision 4.

bogon:~ chenshuangchou$ svn commit -m "在delegate中加入了一句不同的话" /Users/chenshuangchou/Desktop/BuickIOS1/

Sending        Desktop/BuickIOS1/.git/index

svn: E160042: Commit failed (details follow):

svn: E160042: File or directory '.git/index' is out of date; try updating

svn: E160024: resource out of date; try updating

out   of  date表示版本过期,可能是由于另外的开发者更新了服务器版本,而本地代码与服务器冲突

遇到这种情况,应该先从服务器update一下,然后再提交

bogon:~ chenshuangchou$ svn update  Desktop/BuickIOS1/

Updating 'Desktop/BuickIOS1':

Conflict discovered in '/Users/chenshuangchou/Desktop/BuickIOS1/.git/index'.

Select: (p) postpone,

(mf) mine-full, (tf) theirs-full,

(s) show all options:

在这里会有一个选择,选择(s)会显示所有选项的所有注释,如下

(s)  show all    - show this list

(e)  edit             - change merged file in an editor

(df) diff-full        - show all changes made to merged file

(r)  resolved         - accept merged version of file

(dc) display-conflict - show all conflicts (ignoring merged version)

(mc) mine-conflict    - accept my version for all conflicts (same)

(tc) theirs-conflict  - accept their version for all conflicts (same)

(p) postpone  - mark the conflict to be resolved later。

(mf) mine-full  - accept my version of entire file (even non-conflicts)

(tf) theirs-full      - accept their version of entire file (same)

选择一个之后会继续显示冲突点,直到完。而每一个点都会询问怎么处理。

G   Desktop/BuickIOS1/Buickhousekeeper.xcodeproj/project.xcworkspace/xcuserdata/chenshuangchou.xcuserdatad/UserInterfaceState.xcuserstate

Conflict discovered in '/Users/chenshuangchou/Desktop/BuickIOS1/Buickhousekeeper/AppDelegate.h'.

Select: (p) postpone, (df) diff-full, (e) edit,

(mc) mine-conflict, (tc) theirs-conflict,

(s) show all options: tf

G    Desktop/BuickIOS1/Buickhousekeeper/AppDelegate.h

Updated to revision 4.

选择tf之后,冲突点会被服务器上的代码覆盖,自己本地代码会永久不见。最好先选择postpone,确定之后再修改。

关于冲突,可以参考:http://www.logicaltrinkets.com/wordpress/?p=178

7.status命令

查看文件或者目录状态

svn status path (目录下的文件和子目录的状态,正常状态不显示)

?:不在svn的控制中;M:内容被修改;C:发生冲突;A:预定加入到版本库;K:被锁定

svn status -v path 显示所有文件的修改信息,在查看状态的同时,显示本地当前版本号,最后一次修改的版本号和修改人,分别在前

bogon:~ chenshuangchou$ svn status  Desktop/BuickIOS1/

M       Desktop/BuickIOS1/.git/index

?       Desktop/BuickIOS1/.git/objects/1c/7d8324a67dcd866bd0b4122b01b924a0e77128

?       Desktop/BuickIOS1/.git/objects/75/1826a72a4afd4b15faf73a0b6e4166d3bbec01

?       Desktop/BuickIOS1/.git/objects/a4/1c23190a65cda6a64a95bef22a9264ad64d90e

?       Desktop/BuickIOS1/.git/objects/b3/df5dbb592745d9744adf7a32ed2bb39370c78e

M       Desktop/BuickIOS1/Buickhousekeeper/AppDelegate.h

?       Desktop/BuickIOS1/Buickhousekeeper/lastmouth_color1.png

?       Desktop/BuickIOS1/Buickhousekeeper/lastmouth_color2.png

?       Desktop/BuickIOS1/Buickhousekeeper/lastmouth_color3.png

?       Desktop/BuickIOS1/Buickhousekeeper/lastmouth_color4.png

M       Desktop/BuickIOS1/Buickhousekeeper.xcodeproj/project.pbxproj

M      Desktop/BuickIOS1/Buickhousekeeper.xcodeproj/project.xcworkspace/xcuserdata/chenshuangchou.xcuserdatad/UserInterfaceState.xcuserstate

8.delete命令

svn delete path -m " delete test fle "

删除一个空白的文件夹:

bogon:~ chenshuangchou$ svn delete /Users/chenshuangchou/Desktop/BuickIOS/branches

D         Desktop/BuickIOS/branches

显示删除成功

9.log命令

查看版本记录,也叫日志

bogon:~ chenshuangchou$ svn log /Users/chenshuangchou/Desktop/BuickIOS

------------------------------------------------------------------------

r3 | chensc | 2013-10-31 11:34:03 +0800 (四, 31 10 2013) | 1 line

添加了一个油耗柱状图

------------------------------------------------------------------------

r2 | chensc | 2013-10-28 12:00:36 +0800 (一, 28 10 2013) | 1 line

initial import

------------------------------------------------------------------------

r1 | VisualSVN Server | 2013-06-28 17:40:29 +0800 (五, 28  6 2013) | 1 line

Initial structure.

只有两个版本记录,说明第二个版本和第三个版本未添加版本说明,也就是在执行指令时未添加-m  ,这个指令是添加注释

10.diff命令

svn diff path(将修改的文件与基础版本比较)

在上传版本时,可能有自己版本与服务器版本不一致,需要查看具体代码,这个命令就可以做到

svn diff -r m:n path

对版本m和版本n比较差异

在追溯版本问题时,这个命令也十分有用

bogon:~ chenshuangchou$ svn diff /Users/chenshuangchou/Desktop/BuickIOS1

--- /Users/chenshuangchou/Desktop/BuickIOS1/Buickhousekeeper/AppDelegate.h (revision 4)

+++ /Users/chenshuangchou/Desktop/BuickIOS1/Buickhousekeeper/AppDelegate.h (working copy)

@@ -6,6 +6,7 @@

//  Copyright (c) 2013年 calinks. All rights reserved.

//测试的很好

+

#import

#import "BMapKit.h"

@@ -15,7 +16,7 @@

- (void)refreshIdeaMessage;

- (void)refreshMaintainMessage;

-@end

+@end

11.merge命令

将两个版本之间的差异合并到当前文件

bogon:BuickIOS chenshuangchou$ svn merge -r 4:5 /Users/chenshuangchou/Desktop/BuickIOS/Buickhousekeeper/AppDelegate.h

一般会发生冲突,处理冲突

— /Users/chenshuangchou/Desktop/BuickIOS/Buickhousekeeper/svn-1FUb4k 四 10 31 15:36:15 2013

+++ /Users/chenshuangchou/Desktop/BuickIOS/.svn/tmp/AppDelegate.h.tmp 四 10 31 15:36:16 2013

@@ -4,8 +4,13 @@

//  Copyright (c) 2013年 calinks. All rights reserved.

-//测试的很好

+<<<<<<< .working

+//测试一下

+=======

+//验证版本差异合并

+>>>>>>> .merge-right.r5

12.ls命令

版本库下的文件和目录列表

svn list path显示path目录下的所有属于版本库的文件和目录

bogon:BuickIOS chenshuangchou$ svn ls https://192.168.21.248:8443/svn/BuickIOS/

.git/

Buickhousekeeper/

Buickhousekeeper.xcodeproj/

DevOneSDK.framework/

branches/

tags/

trunk/

13.log命令

查看文件详细信息

bogon:~ chenshuangchou$ svn info /Users/chenshuangchou/Desktop/BuickIOS/Buickhousekeeper/AppDelegate.h

Path: Desktop/BuickIOS/Buickhousekeeper/AppDelegate.h

Name: AppDelegate.h

Working Copy Root Path: /Users/chenshuangchou/Desktop/BuickIOS

URL: https://chensc@192.168.21.248:8443/svn/BuickIOS/Buickhousekeeper/AppDelegate.h

Repository Root: https://chensc@192.168.21.248:8443/svn/BuickIOS

Repository UUID: 9a03820f-37b7-b94a-a594-74c58a350bc6

Revision: 4

Node Kind: file

Schedule: normal

Last Changed Author: chensc

Last Changed Rev: 4

Last Changed Date: 2013-10-31 14:04:51 +0800 (四, 31 10 2013)

Text Last Updated: 2013-10-31 14:02:51 +0800 (四, 31 10 2013)

Checksum: 83d8a08d317af33501b650517aa4033d5fe9f0d4

14.其它命令

svn mkdir : 创建纳入版本控制下的新目录。

用法: 1、mkdir PATH...

2、mkdir URL...

svn revert : 恢复原始未改变的工作副本文件 (恢复大部份的本地修改)。revert:

用法: revert PATH...

注意: 本子命令不会存取网络,并且会解除冲突的状况。但是它不会恢复

被删除的目录

svn switch (sw): 更新工作副本至不同的URL。

用法: 1、switch URL [PATH]

2、switch --relocate FROM TO [PATH...]

svn resolved: 移除工作副本的目录或文件的“冲突”状态。

用法: resolved PATH...

注意: 本子命令不会依语法来解决冲突或是移除冲突标记;它只是移除冲突的

相关文件,然后让 PATH 可以再次提交。

svn cat 输出指定文件或URL的内容。

svn cat 目标[@版本]...如果指定了版本,将从指定的版本开始查找。

svn cat -r PREV filename > filename (PREV 是上一版本,也可以写具体版本号,这样输出结果是可以提交的)

iOS开发XCODE5 SVN配置 使用办法 (转) 收藏一下的更多相关文章

  1. iOS开发XCODE5 SVN配置 使用办法

    第一次弄svn版本控制,折腾了好久一直都出错!无意间看到一篇文章!貌似解决了,很感谢“代码妖娆” 的详细流程(http://blog.sina.com.cn/s/blog_68661bd80101ph ...

  2. iOS开发MAC下配置svn

    版本控制对于团队合作显得尤为重要,那么如何在iOS开发中进行版本控制呢?在今天的博客中将会介绍如何在MAC下配置SVN服务器,如何导入我们的工程,如何在Xcode中进行工程的checkOut和Comm ...

  3. iOS开发MAC下配置Svn和Git

    如果你对iOS开发中的版本控制还不了解那么你可以先看看这篇(大致看一遍就ok) http://www.cnblogs.com/iCocos/p/4767692.html   关于版本控制使用起来并不难 ...

  4. ios 开发发布证书配置详细流程

    iOS证书配置实践 本文参考了: iOS证书配置指南:http://dev.umeng.com/push/ios/license-configuration-guide 写在前面: 团队开发证书的管理 ...

  5. iOS开发---百度地图配置流程,2.6.0 版本 支持64位

      1.首先需要在百度地图下载最新SDK:地址: http://developer.baidu.com/map/index.php?title=iossdk/sdkiosdev-download 2. ...

  6. react native ios 开发,基础配置笔记。

    一.获取硬件信息,使用react-native-device-info插件,配置说明: 1.首先需要安装组件:npm install react-native-device-info --save 2 ...

  7. IOS开发:xcode5版本引发的问题

    下面这段代码是用于处理ios7头部透明问题的 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 if ( IOS7_OR_LATER ) { self.e ...

  8. iOS 开发笔记 cocoapods 配置遇到的问题

    当使用svn的时候,每次使用pods update,都会出现一个问题,原来所有的第三方类库里面的.svn都被删除了.提交上svn服务器时,会要求提交全部.如果只是提交如MJExtension这个类库, ...

  9. iOS开发之--svn工具Cornerstone上传忽略.a文件的处理方法

    工程文件上传到svn中,.a文件会自动屏蔽(应该叫屏蔽,反正就是上传不上去) 用Cornerstone工具,解决这个问题 1.打开Cornerstone左上角,点Cornerstone->Pre ...

随机推荐

  1. sklearn学习笔记3

    Explaining Titanic hypothesis with decision trees decision trees are very simple yet powerful superv ...

  2. (转)WCF开发框架形成之旅---WCF的几种寄宿方式

    WCF寄宿方式是一种非常灵活的操作,可以在IIS服务.Windows服务.Winform程序.控制台程序中进行寄宿,从而实现WCF服务的运行,为调用者方便.高效提供服务调用.本文分别对这几种方式进行详 ...

  3. css中 input的button默认原始的样子

    以往我们写css时,让一行文字垂直居中. 会设置line-height等于height比如: 当我把这个原理 放在button上时  会是这个样子的. 以下都是火狐浏览器环境 有没有发现一个现象,他们 ...

  4. JavaScript的学习3

    一.数组 1.定义数组格式:var 变量名 = [数组元素1,数组元素2] 2.遍历数组元素: 格式: var arr = []; for(var i=0;i<数组长度;i++){ arr[i] ...

  5. Javascript iframe交互并兼容各种浏览器的解决方案

    在Web前端开发中,我们经常会用到iframe这个控件. 但是这个控在内.外交互时,往往各个浏览器所用的关键字不同,很是麻烦,为了能够得到子iframe中的window对象,各家浏览器有着各家的指定, ...

  6. 几大最短路径算法比较(Floyd & Dijkstra & Bellman-Ford & SPFA)

    几个最短路径算法的比较:Floyd 求多源.无负权边(此处错误?应该可以有负权边)的最短路.用矩阵记录图.时效性较差,时间复杂度O(V^3).       Floyd-Warshall算法(Floyd ...

  7. VC++动态链接库(DLL)编程深入浅出(zz)

    VC++动态链接库(DLL)编程深入浅出(zz) 1.概论 先来阐述一下DLL(Dynamic Linkable Library)的概念,你可以简单的把DLL看成一种仓库,它提供给你一些可以直接拿来用 ...

  8. 学习FFmpeg API

    ffmpeg是编解码的利器,用了很久,以前看过dranger 的教程,非常精彩,受益颇多,是学习ffmpeg api很好的材料.可惜的是其针对的ffmpeg版本已经比较老了,而ffmpeg的更新又很快 ...

  9. Ajax发送异步请求(四步操作)

    1.第一步(得到XMLHttpRequest) *ajax其实只需要学习一个对象:XMLHttpRequest,如果掌握了它,就掌握了ajax!! *得到XMLHttpRequest >大多数浏 ...

  10. NK3C:关于svg文件使用

    我们从 http://iconfont.cn/ 上下载的SVG文件由以下构成,系统中使用的时候请做适当的修改: 1.width.Height:设置为100%: 2.defs模块去掉:(如果不去掉,IE ...