forked from mirrors/linux
		
	setlocalversion: update mercurial tag parsing
The tag output of hg doesn't quite match what setlocalversion currently expects, so update it to handle the latest format. Signed-off-by: Mike Crowe <mcrowe@zipitwireless.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
This commit is contained in:
		
							parent
							
								
									0719e1d23a
								
							
						
					
					
						commit
						38b3439d84
					
				
					 1 changed files with 9 additions and 5 deletions
				
			
		| 
						 | 
					@ -86,13 +86,17 @@ scm_version()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Check for mercurial and a mercurial repo.
 | 
						# Check for mercurial and a mercurial repo.
 | 
				
			||||||
	if test -d .hg && hgid=`hg id 2>/dev/null`; then
 | 
						if test -d .hg && hgid=`hg id 2>/dev/null`; then
 | 
				
			||||||
		tag=`printf '%s' "$hgid" | cut -s -d' ' -f2`
 | 
							# Do we have an tagged version?  If so, latesttagdistance == 1
 | 
				
			||||||
 | 
							if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
 | 
				
			||||||
		# Do we have an untagged version?
 | 
								id=`hg log -r . --template '{latesttag}'`
 | 
				
			||||||
 | 
								printf '%s%s' -hg "$id"
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								tag=`printf '%s' "$hgid" | cut -d' ' -f2`
 | 
				
			||||||
			if [ -z "$tag" -o "$tag" = tip ]; then
 | 
								if [ -z "$tag" -o "$tag" = tip ]; then
 | 
				
			||||||
				id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
 | 
									id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
 | 
				
			||||||
				printf '%s%s' -hg "$id"
 | 
									printf '%s%s' -hg "$id"
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# Are there uncommitted changes?
 | 
							# Are there uncommitted changes?
 | 
				
			||||||
		# These are represented by + after the changeset id.
 | 
							# These are represented by + after the changeset id.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue