Browse Source

add missing mercurial support

master
belliash 7 years ago
parent
commit
76c56cbd8a
2 changed files with 29 additions and 2 deletions
  1. 2
    2
      config/ezsync.conf
  2. 27
    0
      libraries/repositories

+ 2
- 2
config/ezsync.conf View File

@@ -16,7 +16,7 @@ MODULES_POSTCOMMIT=""
16 16
 # These options specify the build Portage tree, which all the changes are made to, as well
17 17
 # as a mainline Portage tree, which the major updates come from. Ordered parameters are:
18 18
 #	portage name	= name of Portage tree (eg. gentoo-portage)
19
-#	sync protocol	= protocol being used by repository (git, rsync, svn)
19
+#	sync protocol	= protocol being used by repository (git, hg, rsync, svn)
20 20
 #	remote address	= the remote repository address to clone from and send commits to
21 21
 #	optional branch	= in a non-bare repository, this is the branch that will be fetched
22 22
 # NOTE: Not every protocol can be used for building Portage tree!
@@ -26,7 +26,7 @@ PORTAGE_MAINLINE=( "mainline-portage" "rsync" "rsync://rsync.mydomain.org/mainli
26 26
 # These defines the overlays that might be used later in a synchronization process.
27 27
 # Ordered parameters are:
28 28
 #	overlay name	= the overlay name (eg. regen2-overlay)
29
-#	protocol used	= protocol being used by repository (git, rsync, svn)
29
+#	protocol used	= protocol being used by repository (git, hg, rsync, svn)
30 30
 #	remote address	= the remote repository address to clone from and send commits to
31 31
 #	optional branch	= in a non-bare repository, this is the branch that will be fetched
32 32
 #	files to copy	= comma separated list of packages to merge, or ALL to merge every

+ 27
- 0
libraries/repositories View File

@@ -39,6 +39,30 @@ function pullGit() {
39 39
 	return 0
40 40
 }
41 41
 
42
+#-------------------------------------------------------------------------------
43
+# Downloads or updates specified HG repository
44
+# Parameters: %dest_directory% %address% [%branch%]
45
+#-------------------------------------------------------------------------------
46
+function pullMercurial() {
47
+	local DIRECTORY="${1}"
48
+	local ADDRESS="${2}"
49
+	local BRANCH="${3:-default}"
50
+	if [ -d ${DIRECTORY} ]; then
51
+		cd ${DIRECTORY}
52
+		run "hg recover"
53
+		run "hg revert -aC" || return 1
54
+		run "hg purge" || return 1
55
+		run "hg pull" || return 1
56
+	else
57
+		run "hg clone ${ADDRESS} ${DIRECTORY}" || return 1
58
+		if [ ${BRANCH} != "default" ]; then
59
+			run "hg branch ${BRANCH}" || return 1
60
+		fi
61
+		echo -e "\n[extensions]\nhgext.purge=" >> ${DIRECTORY}/.hg/hgrc
62
+	fi
63
+	return 0
64
+}
65
+
42 66
 #-------------------------------------------------------------------------------
43 67
 # Synchronizes specified repository regardless its protocol
44 68
 # Parameters: %dest_directory% %protocol% %address% [%branch%]
@@ -49,6 +73,9 @@ function pullRepository() {
49 73
 			[Gg][Ii][Tt])
50 74
 				pullGit "${1}" "${3}" "${4}" && return 0
51 75
 				;;
76
+			[Hh][Gg])
77
+				pullMercurial "${1}" "${3}" "${4}" && return 0
78
+				;;
52 79
 			[Rr][Ss][Yy][Nn][Cc])
53 80
 				pullRsync "${1}" "${3}" && return 0
54 81
 				;;

Loading…
Cancel
Save