mac电脑,该怎么使用SVN管理开发项目

604 阅读4分钟

公司项目用svn管理,windows电脑有svn管理软件,但是到了Mac电脑,发现这个软件没有Mac版本

查询资料有推荐两款Mac版本的svn管理软件,但都不合用

最后的还是用svn命令方便。

windows版SVN管理软件

TortoiseSVN(小乌龟)

image.png

Mac版SVN管理软件

image.png

SnailSVNLite

SnailSVNLite是App Store中下载的,分为免费版本和收费版本。免费版本只能管理一个svn项目,能够下载下来文件夹,但是下载的内容不全面。而且svn开发,不像分支管理一样,1.0和2.0自由切换,svn需要下载两个文件夹,所以该软件pass。

image.png

image.png

SmartSVN

然后再说说SmartSVN,没有找到破解版本,文件可以全部下载下来,也可进行相应的管理,但是不熟悉,用起来费劲。每次打开空白,总之一句话,不好用。

image.png

最后的解决方案--SVN命令

首先Mac要下载Homebrew,通过Homebrew安装subversion

此步骤可查看另一篇写的文章Mac安装HomeBrew,brew安装svn、git

vscode开发工具下载svn插件

image.png

image.png

.vscode中配置svn

{
    
    // Whether auto refreshing is enabled
  "svn.autorefresh": true,

  // Select all files when commit changes
  "svn.commit.changes.selectedAll": true,

  // Check empty message before commit
  "svn.commit.checkEmptyMessage": true,

  // Set file to status resolved after fix conflicts
  "svn.conflicts.autoResolve": null,

  // Encoding of svn output if the output is not utf-8. When this parameter is null, the encoding is automatically detected. Example: 'windows-1252'.
  "svn.default.encoding": null,

  // The default location to checkout a svn repository.
  "svn.defaultCheckoutDirectory": null,

  // When a file is deleted, what SVN should do? `none` - Do nothing, `prompt` - Ask the action, `remove` - automatically remove from SVN
  "svn.delete.actionForDeletedFiles": "prompt", // values: ["none","prompt","remove"],

  // Ignored files/rules for `svn.delete.actionForDeletedFiles`(Ex.: file.txt or **/*.txt)
  "svn.delete.ignoredRulesForDeletedFiles": [],

  // Controls whether to automatically detect svn externals.
  "svn.detectExternals": true,

  // Controls whether to automatically detect svn on ignored folders.
  "svn.detectIgnored": true,

  // Show diff changes using latest revision in the repository. Set false to use latest revision in local folder
  "svn.diff.withHead": true,

  // Whether svn is enabled
  "svn.enabled": true,

  // Try the experimental encoding detection
  "svn.experimental.detect_encoding": null,

  // Priority of encoding
  "svn.experimental.encoding_priority": [],

  // Url for the gravitar icon using the <AUTHOR>, <AUTHOR_MD5> and <SIZE> placeholders
  "svn.gravatar.icon_url": "https://www.gravatar.com/avatar/<AUTHOR_MD5>.jpg?s=<SIZE>&d=robohash",

  // Use garavatar icons in log viewers
  "svn.gravatars.enabled": true,

  // Ignores the warning when SVN is missing
  "svn.ignoreMissingSvnWarning": null,

  // List of SVN repositories to ignore.
  "svn.ignoreRepositories": null,

  // Ignores the warning when working copy is too old
  "svn.ignoreWorkingCopyIsTooOld": null,

  // Regex to detect path for 'branches' in SVN URL, 'null' to disable. Subpath use 'branches/[^/]+/([^/]+)(/.*)?' (Ex.: 'branches/...', 'versions/...')
  "svn.layout.branchesRegex": "branches/([^/]+)(/.*)?",

  // Regex group position for name of branch
  "svn.layout.branchesRegexName": 1,

  // Set true to show 'branches/<name>' and false to show only '<name>'
  "svn.layout.showFullName": true,

  // Regex group position for name of tag
  "svn.layout.tagRegexName": 1,

  // Regex to detect path for 'tags' in SVN URL, 'null' to disable. Subpath use 'tags/[^/]+/([^/]+)(/.*)?'. (Ex.: 'tags/...', 'stamps/...')
  "svn.layout.tagsRegex": "tags/([^/]+)(/.*)?",

  // Regex to detect path for 'trunk' in SVN URL, 'null' to disable. (Ex.: '(trunk)', '(main)')
  "svn.layout.trunkRegex": "(trunk)(/.*)?",

  // Regex group position for name of trunk
  "svn.layout.trunkRegexName": 1,

  // Number of commit messages to log
  "svn.log.length": 50,

  // Maximum depth to find subfolders using SVN
  "svn.multipleFolders.depth": 4,

  // Allow to find subfolders using SVN
  "svn.multipleFolders.enabled": null,

  // Folders to ignore using SVN
  "svn.multipleFolders.ignore": ["**/.git", "**/.hg", "**/vendor", "**/node_modules"],

  // Path to the svn executable
  "svn.path": null,

  // Only show previous commits for a given user. Requires svn >= 1.8
  "svn.previousCommitsUser": null,

  // Refresh remote changes on refresh command
  "svn.refresh.remoteChanges": null,

  // Set the interval in seconds to check changed files on remote repository and show in statusbar. 0 to disable
  "svn.remoteChanges.checkFrequency": 300,

  // Show the output window when the extension starts
  "svn.showOutput": null,

  // Show the update message when update is run
  "svn.showUpdateMessage": true,

  // Set left click functionality on changes resource state
  "svn.sourceControl.changesLeftClick": "open diff", // values: ["open","open diff"],

  // Combine the svn external in the main if is from the same server.
  "svn.sourceControl.combineExternalIfSameServer": null,

  // Allow to count unversioned files in status count
  "svn.sourceControl.countUnversioned": true,

  // Hide unversioned files in Source Control UI
  "svn.sourceControl.hideUnversioned": null,

  // Ignore unversioned files like .gitignore, Configuring this will overlook the default ignore rule
  "svn.sourceControl.ignore": [],

  // Changelists to ignore on commit
  "svn.sourceControl.ignoreOnCommit": ["ignore-on-commit"],

  // Changelists to ignore on status count
  "svn.sourceControl.ignoreOnStatusCount": ["ignore-on-commit"],

  // Set to ignore externals definitions on update (add --ignore-externals)
  "svn.update.ignoreExternals": true
}

SVN常用命令

svn checkout svn://10.64.15.83:89898/web/trunk/project2.0			
                                   从服务器拉取代码到本地
svn cleanup                        删除锁
svn update			   更新拉取代码
svn commmit -m '提交说明' 	        提交到版本库
svn add . --no-ignore --force	   递归添加当前目录下的所有新文件
svn log                            查看日志
svn diff                           比较差异

svn mkdir:创建新目录
svn delete:删除目录或文件

svn info:查看文件详细信息
svn merge:将两个源差异应用至工作副本
svn help:帮助

svn revert:恢复本地修改,撤销对本地代码所做的修改恢复到未改变的状态
svn status:查看目录或文件的工作状态
‘A’:预定加入到版本库
‘C’:发生冲突
‘D’:被删除了
‘M’:内容被修改
‘?’:未纳入版本控制
‘!’:已遗失或不完整
‘~’:版本控制下的项目与其他类型的项目重名

代码提交前,可在开发工具中查看修改的内容

image.png

目前常用的命令

% svn update 
% svn commit -m 'bug修复'  
正在发送       src/views/commonConfig/fileTemplate/components/HeaderForm/index.vue
正在发送       src/views/commonConfig/transactionFlow/components/TableItem.vue
正在增加       src/views/systemManage/serviceControl
正在增加       src/views/systemManage/serviceControl/AddBlack.vue
传输文件数据..done
正在读取事务
提交后的版本为 34297。

 % svn update
正在升级 '.':
版本 34297。