	$ mkdir patches

	$ quilt new patch1.diff
	> Patch %{P}patch1.diff is now on top

	$ quilt top
	> %{P}patch1.diff

	$ quilt add f
	> File f added to patch %{P}patch1.diff

	$ echo f > f

	$ ls patches/
	> series

	$ quilt new patch2.diff
	> Patch %{P}patch2.diff is now on top

	$ quilt previous
	> %{P}patch1.diff

	$ quilt add g
	> File g added to patch %{P}patch2.diff

	$ echo g > g

	$ quilt refresh
	> Refreshed patch %{P}patch2.diff

	# Test diff called with multiple file names
	$ quilt diff -p0 f g
	> Index: g
	> ===================================================================
	> --- /dev/null
	> +++ g
	> @@ -0,0 +1 @@
	> +g

	# Test that diff strips the "./" prefix
	$ quilt diff -p0 ./f ./g
	> Index: g
	> ===================================================================
	> --- /dev/null
	> +++ g
	> @@ -0,0 +1 @@
	> +g

	$ quilt pop
	> Removing patch %{P}patch2.diff
	> Removing g
	>
	> Now at patch %{P}patch1.diff

	$ ls patches/
	> patch2.diff
	> series

	$ quilt next
	> %{P}patch2.diff

	$ quilt previous
	$ quilt previous patch2
	> %{P}patch1.diff

	$ quilt pop
	> Patch %{P}patch1.diff does not remove cleanly (refresh it or enforce with -f)

	$ quilt refresh
	> Refreshed patch %{P}patch1.diff

	$ quilt refresh patch2
	> Patch %{P}patch2.diff is not applied

	$ quilt pop
	> Removing patch %{P}patch1.diff
	> Removing f
	>
	> No patches applied

	$ quilt top
	> No patches applied

	$ quilt pop
	> No patch removed
	$ echo %{?}
	> 2

	$ quilt applied
	> No patches applied

	$ quilt unapplied
	> %{P}patch1.diff
	> %{P}patch2.diff

	$ quilt previous
	> No patches applied

	$ quilt next
	> %{P}patch1.diff

	$ quilt applied patch1
	> Patch %{P}patch1.diff is not applied

	$ quilt unapplied patch2
	$ quilt unapplied patch1
	> %{P}patch2.diff

	$ quilt revert f
	> No patches applied

	$ quilt delete patch3.diff
	> Patch patch3.diff is not in series

	$ quilt push -qa
	> Applying patch %{P}patch1.diff
	> Applying patch %{P}patch2.diff
	> Now at patch %{P}patch2.diff

	$ quilt push patch2
	> Patch %{P}patch2.diff is currently applied

	$ quilt push
	> File series fully applied, ends at patch %{P}patch2.diff
	$ echo %{?}
	> 2

	$ quilt diff --combine patch1 -P patch2 -p ab
	> Index: b/f
	> ===================================================================
	> --- /dev/null
	> +++ b/f
	> @@ -0,0 +1 @@
	> +f
	> Index: b/g
	> ===================================================================
	> --- /dev/null
	> +++ b/g
	> @@ -0,0 +1 @@
	> +g

	$ quilt diff -P patch1 --combine patch2
	> Patch %{P}patch2.diff not applied before patch %{P}patch1.diff

	$ echo patch3.diff >> patches/series
	$ quilt diff -P patch1 --combine patch3
	> Patch %{P}patch3.diff is not applied

	$ quilt pop -qaR
	> Removing patch %{P}patch2.diff
	> Removing patch %{P}patch1.diff
	> No patches applied

	$ quilt annotate f
	> No patches applied

	$ quilt pop patch4.diff
	> Patch patch4.diff is not in series

	$ quilt grep "not there"

	$ quilt push -q 2
	> Applying patch %{P}patch1.diff
	> Applying patch %{P}patch2.diff
	> Now at patch %{P}patch2.diff

	$ quilt pop -q 2
	> Removing patch %{P}patch2.diff
	> Removing patch %{P}patch1.diff
	> No patches applied

	$ quilt push -q 10
	> Applying patch %{P}patch1.diff
	> Applying patch %{P}patch2.diff
	> Applying patch %{P}patch3.diff
	> Patch %{P}patch3.diff does not exist; applied empty patch
	> Now at patch %{P}patch3.diff

	$ quilt pop -q 10
	> Patch %{P}patch3.diff appears to be empty, removing
	> Removing patch %{P}patch2.diff
	> Removing patch %{P}patch1.diff
	> No patches applied

	$ quilt push 0
	> No patch applied
	$ echo %{?}
	> 2

	$ quilt pop 0
	> No patch removed
	$ echo %{?}
	> 2
