{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/svn-usage-management-guide/",
  "atlas": "https://www.pystone.net/?node=svn-usage-management-guide#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/svn-usage-management-guide.md",
  "context": "https://www.pystone.net/notes/svn-usage-management-guide.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:svn-usage-management-guide",
  "slug": "svn-usage-management-guide",
  "title": "【SCM】SVN使用方法与管理规范",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "【SCM】SVN使用方法与管理规范",
  "contentRole": "unspecified",
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "unspecified",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "d5148cc0a2fc96fe0acd184bdcb5b5d8b04824f8081df8de57d57bcfd74688d4",
  "assets": [
    {
      "reference": "assets/0012 - 【SCM】SVN使用方法与管理规范__resource-001-8d3c6c37dee0.png",
      "url": "/media/13c3846b69094cf079b7.png",
      "mediaType": "image/png",
      "contentHash": "13c3846b69094cf079b75d8ba8e98d328197b0dbbce3873a175014006710609a",
      "byteLength": 5091,
      "width": 294,
      "height": 159
    },
    {
      "reference": "assets/0012 - 【SCM】SVN使用方法与管理规范__resource-002-287efb437bea.png",
      "url": "/media/bb72b3d478ec15c3b812.png",
      "mediaType": "image/png",
      "contentHash": "bb72b3d478ec15c3b812a32a50ca5dc2fdda5c40873f18a6127960b7e6716560",
      "byteLength": 23713,
      "width": 572,
      "height": 514
    },
    {
      "reference": "assets/0012 - 【SCM】SVN使用方法与管理规范__resource-003-f36b7d33975b.png",
      "url": "/media/064d773d6b6e81899e4c.png",
      "mediaType": "image/png",
      "contentHash": "064d773d6b6e81899e4c7cf7571923d208587096e3be42dadedc6579d03eeca5",
      "byteLength": 47906,
      "width": 555,
      "height": 582
    },
    {
      "reference": "assets/0012 - 【SCM】SVN使用方法与管理规范__resource-004-fafd7c40841e.png",
      "url": "/media/46a4bc6c5a5711d51741.png",
      "mediaType": "image/png",
      "contentHash": "46a4bc6c5a5711d5174153730bcc3d03d2de4bc7dea7237a6582c656fd3b4e91",
      "byteLength": 44562,
      "width": 1133,
      "height": 598
    },
    {
      "reference": "assets/0012 - 【SCM】SVN使用方法与管理规范__resource-005-7eec2d172c66.png",
      "url": "/media/fd73d6373126f429247d.png",
      "mediaType": "image/png",
      "contentHash": "fd73d6373126f429247d8771aa2bc30aa636e120d406ecd59a1df527f1b77d0a",
      "byteLength": 17861,
      "width": 581,
      "height": 508
    },
    {
      "reference": "assets/0012 - 【SCM】SVN使用方法与管理规范__resource-006-56f04bc03da5.png",
      "url": "/media/e9f4d6be67e1c9091a2e.png",
      "mediaType": "image/png",
      "contentHash": "e9f4d6be67e1c9091a2e12043cdf1b988a7de6eb5aa96c7215101ff4025325ec",
      "byteLength": 23998,
      "width": 599,
      "height": 352
    },
    {
      "reference": "assets/0012 - 【SCM】SVN使用方法与管理规范__resource-007-d67b4405a144.png",
      "url": "/media/6c8f794b87701fff356d.png",
      "mediaType": "image/png",
      "contentHash": "6c8f794b87701fff356dd7ecc2d80e8156211e8f0e8d696b0586fc775dd4ae19",
      "byteLength": 4067,
      "width": 342,
      "height": 160
    }
  ],
  "headings": [
    {
      "depth": 1,
      "text": "【SCM】SVN使用方法与管理规范",
      "anchor": "scmsvn使用方法与管理规范",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#scmsvn%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95%E4%B8%8E%E7%AE%A1%E7%90%86%E8%A7%84%E8%8C%83"
    },
    {
      "depth": 2,
      "text": "SVN",
      "anchor": "svn",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#svn"
    },
    {
      "depth": 3,
      "text": "术语",
      "anchor": "术语",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E6%9C%AF%E8%AF%AD"
    },
    {
      "depth": 3,
      "text": "特性",
      "anchor": "特性",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E7%89%B9%E6%80%A7"
    },
    {
      "depth": 4,
      "text": "版本号（Revision）",
      "anchor": "版本号revision",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E7%89%88%E6%9C%AC%E5%8F%B7revision"
    },
    {
      "depth": 4,
      "text": "不同版本之间如何保存",
      "anchor": "不同版本之间如何保存",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E4%B8%8D%E5%90%8C%E7%89%88%E6%9C%AC%E4%B9%8B%E9%97%B4%E5%A6%82%E4%BD%95%E4%BF%9D%E5%AD%98"
    },
    {
      "depth": 3,
      "text": "常用命令",
      "anchor": "常用命令",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"
    },
    {
      "depth": 4,
      "text": "remove & add files",
      "anchor": "remove-add-files",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#remove-add-files"
    },
    {
      "depth": 3,
      "text": "认证相关",
      "anchor": "认证相关",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E8%AE%A4%E8%AF%81%E7%9B%B8%E5%85%B3"
    },
    {
      "depth": 4,
      "text": "用户名密码的保存",
      "anchor": "用户名密码的保存",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E7%94%A8%E6%88%B7%E5%90%8D%E5%AF%86%E7%A0%81%E7%9A%84%E4%BF%9D%E5%AD%98"
    },
    {
      "depth": 3,
      "text": "冲突解决",
      "anchor": "冲突解决",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E5%86%B2%E7%AA%81%E8%A7%A3%E5%86%B3"
    },
    {
      "depth": 4,
      "text": "file conflicts",
      "anchor": "file-conflicts",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#file-conflicts"
    },
    {
      "depth": 4,
      "text": "tree conflicts",
      "anchor": "tree-conflicts",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#tree-conflicts"
    },
    {
      "depth": 3,
      "text": "分支创建与合并",
      "anchor": "分支创建与合并",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E5%88%86%E6%94%AF%E5%88%9B%E5%BB%BA%E4%B8%8E%E5%90%88%E5%B9%B6"
    },
    {
      "depth": 4,
      "text": "分支创建",
      "anchor": "分支创建",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E5%88%86%E6%94%AF%E5%88%9B%E5%BB%BA"
    },
    {
      "depth": 4,
      "text": "分支合并",
      "anchor": "分支合并",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E5%88%86%E6%94%AF%E5%90%88%E5%B9%B6"
    },
    {
      "depth": 5,
      "text": "Merge a range of revisions",
      "anchor": "merge-a-range-of-revisions",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#merge-a-range-of-revisions"
    },
    {
      "depth": 5,
      "text": "commit message",
      "anchor": "commit-message",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#commit-message"
    },
    {
      "depth": 2,
      "text": "SVN Server搭建与使用",
      "anchor": "svn-server搭建与使用",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#svn-server%E6%90%AD%E5%BB%BA%E4%B8%8E%E4%BD%BF%E7%94%A8"
    },
    {
      "depth": 3,
      "text": "Linux",
      "anchor": "linux",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#linux"
    },
    {
      "depth": 4,
      "text": "相关教程",
      "anchor": "相关教程",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E7%9B%B8%E5%85%B3%E6%95%99%E7%A8%8B"
    },
    {
      "depth": 3,
      "text": "Windows",
      "anchor": "windows",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#windows"
    },
    {
      "depth": 2,
      "text": "Unity项目管理方式",
      "anchor": "unity项目管理方式",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#unity%E9%A1%B9%E7%9B%AE%E7%AE%A1%E7%90%86%E6%96%B9%E5%BC%8F"
    },
    {
      "depth": 3,
      "text": "Unity工程设置",
      "anchor": "unity工程设置",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#unity%E5%B7%A5%E7%A8%8B%E8%AE%BE%E7%BD%AE"
    },
    {
      "depth": 3,
      "text": "ignore配置",
      "anchor": "ignore配置",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#ignore%E9%85%8D%E7%BD%AE"
    },
    {
      "depth": 2,
      "text": "坑点",
      "anchor": "坑点",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#%E5%9D%91%E7%82%B9"
    },
    {
      "depth": 2,
      "text": "Ref",
      "anchor": "ref",
      "citation": "https://www.pystone.net/notes/svn-usage-management-guide/#ref"
    }
  ],
  "claims": [],
  "outgoing": [],
  "incoming": [
    {
      "id": "note:software-engineering-and-quality",
      "title": "软件工程与质量保障",
      "url": "https://www.pystone.net/notes/software-engineering-and-quality/",
      "atlas": "https://www.pystone.net/?node=software-engineering-and-quality#knowledge-atlas",
      "label": "软件工程与质量保障",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "CI-CD与质量保障/CI-CD工具链中的“【SCM】SVN使用方法与管理规范”导航项",
      "citation": "https://www.pystone.net/notes/software-engineering-and-quality/#ci-cd%E4%B8%8E%E8%B4%A8%E9%87%8F%E4%BF%9D%E9%9A%9Cci-cd%E5%B7%A5%E5%85%B7%E9%93%BE"
    }
  ],
  "contentMarkdown": "# 【SCM】SVN使用方法与管理规范\n\n﻿# 【SCM】SVN使用方法与管理规范\n\n> 创建时间：2021/4/26 13:24\n\n* SVN\n    * 术语\n    * 特性\n      * 版本号（Revision）\n      * 不同版本之间如何保存\n    * 常用命令\n      * remove & add files\n    * 认证相关\n      * 用户名密码的保存\n    * 冲突解决\n      * file conflicts\n      * tree conflicts\n    * 分支创建与合并\n      * 分支创建\n      * 分支合并\n        * Merge a range of revisions\n        * commit message\n  * SVN Server搭建与使用\n    * Linux\n      * 相关教程\n    * Windows\n  * Unity项目管理方式\n    * Unity工程设置\n    * ignore配置\n  * 坑点\n  * Ref\n\n## SVN\n\n### 术语\n\nrepository（版本库）：文件统一存放的地方。\ncheckout（检出）：当你手上没有源文件的时候，你需要从repository 提取一份。\ncommit（提交）：当你已经修改了文件，你就需要Commit到repository。\nupdate (更新)：当你已经Checkout了一份文件，Update一下，你的文件就会与服务器同步。\n\n### 特性\n\n#### 版本号（Revision）\n\n在一个repository，版本号是一个全局资源，不管是trunk、branch还是tag，他们使用的版本号不会重复，比如现在trunk已经用掉2这个版本号，那么分支就只能往下一个，用3\n\n#### 不同版本之间如何保存\n\nsvn在不同的revision之间，只保留差异（diff），而不会在某个版本保留完整的项目内容。\n\n### 常用命令\n\nsvn info 仓库信息\nsvn st 查版本状态\nsvn revert . -R 还原所有更改\nsvn cleanup . --remove-unversioned 清理未被版本控制的文件\nsvn update\n\n输入用户名密码\nsvn update --username xxx --password xxx\n其他：https://gist.github.com/hendrauzia/5123163\n\n命令行分支与合并：https://www.cnblogs.com/zhming26/p/5886209.html\n\n#### remove & add files\n\nsvn status (stat, st) — Print the status of working copy files and directories.\n\n> '?' - Item is not under version control.\n>  '!' - Item is missing\n\nsvn add — Add files, directories, or symbolic links.\n\n> -force option makes svn add recurse into versioned directories:\n\nsvn delete (del, remove, rm) — Delete an item from a working copy or the repository.\n\n* * *\n\nadd unversioned files\n\n```cpp\nstring s = String.Empty;\n\n```\n\nref: https://stackoverflow.com/questions/1071857/how-do-i-svn-add-all-unversioned-files-to-svn\n\n* * *\n\ndelete all locally missing files\n\n```cpp\nstring s = String.Empty;\n\n```\n\n> 异常： 此处不允许铆钉版本范围(peg revision is not allowed here)\n>  Because: SVN uses the @ symbol as a way to determine a specific revision. 文件路径中有@就会报错。\n>  解决方法：add an @ symbol at the end of the filename, like so:\n\n```cpp\nstring s = String.Empty;\n\n```\n```cpp\nstring s = String.Empty;\n\n```\n\nref: https://stackoverflow.com/questions/9600382/svn-command-to-delete-all-locally-missing-files\nref: https://newbedev.com/svn-command-to-delete-all-locally-missing-files\n\n### 认证相关\n\n#### 用户名密码的保存\n\nUnix-like systems:\n\n~/.subversion 目录保存了svn相关配置信息\n\n~/.subversion/auth 目录下包含了svn使用过的用户信息\n~/.subversion/auth/svn.simple 一些svn账号信息，如果保存了密码，在这里还可以看保存下来的密码。\n\nWindows:\nC:\\Documents and Settings\\Administrator\\Application Data\\Subversion\\auth\n\nTortoiseSVN: Settings->Saved Data->Authentication data\n\n* * *\n\nMacOS X上，保存密码的方式为keychain。svn.simple目录下只保存仓库的用户名，密码保存在keychain（钥匙串访问）程序中。可以打开程序来查看。\n\n* * *\n\n删除密码的方式：\n\n```cpp\nstring s = String.Empty;\n\n```\n\n或者直接删除svn.simple目录下的相关文件。\n\n### 冲突解决\n\n#### file conflicts\n\nA file conflict occurs if two (or more) developers have changed the same few lines of a file.\n\n方式一：\nrevert 放弃修改\nupdate 更新至最新\n在最新的基础上修改后再提交\n\n* * *\n\n方式二：\nupdate 产生冲突文件\n\n手动解决冲突\n\n  * 手动编辑\n  * 右键冲突文件->TortoiseSVN->Edit Conflicts\n\nMark as resolve\nCommit\n\n* * *\n\nsvn产生的冲突文件：\n\n![](assets/0012 - 【SCM】SVN使用方法与管理规范__resource-001-8d3c6c37dee0.png)\n\n文件名.扩展名.mine : 我修改后的文件\n文件名.扩展名.r旧版本\n文件名.扩展名.r新版本\n\n#### tree conflicts\n\nA tree conflict occurs when a developer moved/renamed/deleted a file or folder, which another developer either also has moved/renamed/deleted or just modified.\n\n解决方式：\n\n![](assets/0012 - 【SCM】SVN使用方法与管理规范__resource-002-287efb437bea.png)\n\n### 分支创建与合并\n\nhttps://blog.csdn.net/justry_deng/article/details/82259470\nhttps://www.cnblogs.com/xdouby/p/7237005.html\n\n#### 分支创建\n\n可以直接在branches目录下创建文件夹，并进行commit，也可以使用Tortoise的Branch/Tag功能，如下图所示。\n\n![](assets/0012 - 【SCM】SVN使用方法与管理规范__resource-003-f36b7d33975b.png)\n\n#### 分支合并\n\n使用TortoiseSVN进行合并，实际上是合并到本地，合并完成之后，需要进行commit才会将合并结果提交到中央仓库当中。\n\n> svn上每个提交版本，都对应一组操作，你可能在本次提交中修改、新增、删除了某些文件，这些操作和这个版本对应。也就是说，SVN对每个版本只保留了这个版本与上个版本的差异信息。\n\n合并的本质是：将某个版本（或者某个版本范围）的 **操作** 应用到本地的working copy。\n\n##### Merge a range of revisions\n\nall revisions: 获取指定的工程最新一个版本和最初的一个版本的差异diff，将这个diff合并到当前working copy。\n\n> 假设最新版本是r-last，最初的版本r-first，r-last相对r-first而言，增加了文件a，修改了文件b，那么在合并的时候，就将“增加文件a，修改文件b”的操作应用在本地的working copy上面去，这就完成了合并\n\nspecific range，单独指定一个版本：将这个版本与最初版本的diff合并到当前working copy\nspecific range，不填写任何值：当于选all revisions\nspecific range，选择一个版本范围：假设用户指定了版本r1-r3，其中r1新增了文件a，r2新增了文件b，r3删除了文件c，那么在合并的时候TortoiseSVN就会将“新增文件a，新增文件b，删除文件c”应用于本地的 working copy；\n\n一般选择specific range，明确哪些差异是我们要合并的版本的差异，把相应范围的revision合并进来即可。\n\n![](assets/0012 - 【SCM】SVN使用方法与管理规范__resource-004-fafd7c40841e.png)\n\nTest Merge可以预测试合并的结果：\n\n![](assets/0012 - 【SCM】SVN使用方法与管理规范__resource-005-7eec2d172c66.png)\n\n##### commit message\n\n在提交合并结果时，点击“Recent Messages”即可获取自动生成的合并信息。\n\n![](assets/0012 - 【SCM】SVN使用方法与管理规范__resource-006-56f04bc03da5.png)\n\n![](assets/0012 - 【SCM】SVN使用方法与管理规范__resource-007-d67b4405a144.png)\n\n## SVN Server搭建与使用\n\n### Linux\n\nhttps://www.runoob.com/w3cnote/linux-subversion-yum.html\n\n```cpp\nstring s = String.Empty;\n\n```\n\n权限配置：\n\nauthz文件：\n\n```cpp\nstring s = String.Empty;\n\n```\n\npassword文件\n\n```cpp\nstring s = String.Empty;\n\n```\n\n#### 相关教程\n\n  * SVN Server\n\nhttps://www.runoob.com/w3cnote/linux-subversion-yum.html\nhttps://svnbook.red-bean.com/en/1.7/svn.serverconfig.svnserve.html#svn.serverconfig.svnserve.invoking.daemon\nhttps://www.cnblogs.com/xieyuan/p/3787322.html\nhttps://www.jianshu.com/p/e7037e010635\n\n  * Apache SVN: https://www.vultr.com/docs/how-to-setup-an-apache-subversion-svn-server-on-centos-7\n\n### Windows\n\n常用操作:\nCreate New Repository\nImport Existing Repository\n右键Users -> Create User\n右键Groups -> Create Group\n右键仓库目录 -> Properties ：管理用户权限\n\n## Unity项目管理方式\n\n详细教程: https://www.jianshu.com/p/1e9a1b1ad7e4\n\n只有两个目录是需要版本管理的：Assets、ProjectSettings。\n提交的时候仅提交Assets 和 ProjectSettings 两个目录下所有东西，忽略掉其他所有目录和文件。\n\n### Unity工程设置\n\n  * Edit->Project Settings->Editor：Version Control 选择为[Visible Meta Files]；\n  * Editor-> Project Settings->Editor：Asset Serialization Mode选择为：[Force Text]\n  * Edit->Preferences -> Packages：Repository选择为[External]；\n\n### ignore配置\n\n```cpp\nstring s = String.Empty;\n\n```\n\n## 坑点\n\nsvn log无法显示信息：\n\nresolution1: Set Anonomous Access to none\nresolution2: add * = r to authz [/]\n\nhttps://bugzilla.redhat.com/show_bug.cgi?id=556712\nhttps://devzing.com/blog/index.php/subversion-tip-fix-missing-date-and-author-in-log/\n\n## Ref\n\nhttps://blog.csdn.net/xgf415/article/details/75196360\n"
}
