Skip to contentSkip to conversation

dim: print branches containing commit-ish if no tag contains it

PATCH In review Jani Nikula 2 participants 3 messages Oct 22, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dim: print branches containing commit-ish if no tag contains it

dim tc is useful for checking when and where a commit has landed, so one can decide where, for example, a fix to that commit should be queued.

If the commit is not in a tagged upstream Linux release, fall back to printing the i915 upstream development branches that contain it.

---
 dim     | 8 +++++++-
 dim.rst | 3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)
dim +7 -1
index bd7cae828ee7..3bd5b759f8a7 100755
@@ -808,7 +808,13 @@ case "$subcommand" in
 		;;
 	tc)
 		cd $DIM_PREFIX/$DIM_DRM_INTEL
-		git tag --contains $1 | grep ^v | sort -V | head -n 1
+		tag=$(git tag --contains $1 | grep ^v | sort -V | head -n 1)
+		if [[ -n "$tag" ]]; then
+			echo "$tag"
+		else
+			# not in a tagged release, show branches
+			git branch --contains $1 drm-intel-* master topic/* | sed 's/^[ \*]*//'
+		fi
 		;;
 	check-patch|cp)
 		dim_checkrange $@
dim.rst +2 -1
index ebbc04bc3604..a1da6e0b4621 100644
@@ -174,7 +174,8 @@ Apply a patch to the i-g-t repository.
 
 tc *commit-ish*
 ---------------
-Prints the linux kernel tag which contains the supplied commit-ish
+Print the oldest Linux kernel release or -rc tag that contains the supplied
+*commit-ish*, or, if none do, print the branches that contain it.
 
 check-patch|cp [*commit-ish* [.. *commit-ish*]]
 -----------------------------------------------
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 17 lines · Jani Nikula

dim tc is useful for checking when and where a commit has landed, so one can decide where, for example, a fix to that commit should be queued.

If the commit is not in a tagged upstream Linux release, fall back to printing the i915 upstream development branches that contain it.

---
 dim     | 8 +++++++-
 dim.rst | 3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)
dim +0 -0
index bd7cae828ee7..3bd5b759f8a7 100755

dim case "$subcommand" in · line 816

Quoted 10 lines
dim +6 -1
@@ -808,7 +808,13 @@ case "$subcommand" in
 		;;
 	tc)
 		cd $DIM_PREFIX/$DIM_DRM_INTEL
-		git tag --contains $1 | grep ^v | sort -V | head -n 1
+		tag=$(git tag --contains $1 | grep ^v | sort -V | head -n 1)
+		if [[ -n "$tag" ]]; then
+			echo "$tag"
+		else
+			# not in a tagged release, show branches
+			git branch --contains $1 drm-intel-* master topic/* | sed 's/^[ \*]*//'

Shouldn't we check the remote branches instead? Since at least for me the local -fixes branches are usually rather old ... We could sed the remote prefix away again I guess. lgtm otherwise.
-Daniel

Quoted 25 lines
dim +1 -0
+		fi
 		;;
 	check-patch|cp)
 		dim_checkrange $@
dim.rst +2 -1
index ebbc04bc3604..a1da6e0b4621 100644
@@ -174,7 +174,8 @@ Apply a patch to the i-g-t repository.
 
 tc *commit-ish*
 ---------------
-Prints the linux kernel tag which contains the supplied commit-ish
+Print the oldest Linux kernel release or -rc tag that contains the supplied
+*commit-ish*, or, if none do, print the branches that contain it.
 
 check-patch|cp [*commit-ish* [.. *commit-ish*]]
 -----------------------------------------------
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 1/1 dim: print branches containing commit-ish if no tag contains it

dim tc is useful for checking when and where a commit has landed, so one can decide where, for example, a fix to that commit should be queued.

If the commit is not in a tagged upstream Linux release, fall back to printing the i915 upstream development branches that contain it.

v2: check for remote branches (Daniel)

---
 dim     | 12 +++++++++++-
 dim.rst |  3 ++-
 2 files changed, 13 insertions(+), 2 deletions(-)
dim +11 -1
index bd7cae828ee7..cdb48b9f8976 100755
@@ -808,7 +808,17 @@ case "$subcommand" in
 		;;
 	tc)
 		cd $DIM_PREFIX/$DIM_DRM_INTEL
-		git tag --contains $1 | grep ^v | sort -V | head -n 1
+		tag=$(git tag --contains $1 | grep ^v | sort -V | head -n 1)
+		if [[ -n "$tag" ]]; then
+			echo "$tag"
+		else
+			# not in a tagged release, show upstream branches
+			git branch -r --contains $1 \
+			    $DIM_DRM_INTEL_REMOTE/* \
+			    $DIM_DRM_UPSTREAM_REMOTE/drm-next \
+			    $DIM_DRM_UPSTREAM_REMOTE/drm-fixes \
+			    origin/master | sed 's/^ *//'
+		fi
 		;;
 	check-patch|cp)
 		dim_checkrange $@
dim.rst +2 -1
index ebbc04bc3604..d5ec5c8128fd 100644
@@ -174,7 +174,8 @@ Apply a patch to the i-g-t repository.
 
 tc *commit-ish*
 ---------------
-Prints the linux kernel tag which contains the supplied commit-ish
+Print the oldest Linux kernel release or -rc tag that contains the supplied
+*commit-ish*, or, if none do, print the upstream branches that contain it.
 
 check-patch|cp [*commit-ish* [.. *commit-ish*]]
 -----------------------------------------------
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx