Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • thg thg
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 829
    • Issues 829
    • List
    • Boards
    • Service Desk
    • Milestones
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • mercurial
  • TortoiseHg
  • thgthg
  • Issues
  • #5509
Closed
Open
Created Jan 26, 2020 by Bitbucket Importer@bitbucket_importerOwner

MQ: Implement keyboard shortcut Shift+Enter for "Unapply one patch" from patch queue (or "Unapply up to this patch")

Created originally on Bitbucket by thomasdd (Thomas D.)

As a regular user of MQ aka “Patch Queue” for many years, I often need to unapply the first (and only) applied patch in the queue (qbase = qtip). Pressing Enter comes to mind, but that only stubbornly repeats “Go to patch” although this patch is already qtip. I could not find any other way of doing this with keyboard, because both “Unapply one patch” and “Unapply all patches” are not keyboard accessible. The click targets on the Patch Queue toolbar are very small, and the icons look very similar, so not easy to target.

STR:

  1. MQ/Patch Queue widget: have exactly one applied patch (qbase = qtip)
  2. Try to unapply that patch using keyboard only

Actual result

  • all ways of unapplying this patch (qbase = qtip) are not keyboard accessible

Expected result

  1. Pressing plain ENTER on qtip could helpfully unapply qtip (rather than trying and failing to “Go to this patch” which doesn’t make sense because it’s already qtip)
  2. Pressing Shift+Enter with focus in Patch Queue should at least trigger the existing action “Unapply one patch” (regardless of selection). That’s a very basic solution which requires something like 4 lines of code, @{557058:4b06a480-f21c-438a-ac32-49c7e6bffe0a} has done exactly the same for F2 in issue #4915 (closed).
  3. If we want to be a bit smarter and more helpful, we could try this:
    Shift+Enter → “Unapply up to this patch” (for single selection of an applied patch)
    “Unapply selected patches” (for multiple, contiguous selection including qtip)

Pseudo Code for advanced handling of Shift+Enter (3 above):

If ((selectedPatchs.length == 0) OR  // focus only on any single patch
    (selectedPatches.length == 1 AND selectedPatches.isApplied == false)) // selection of single, unapplied patch
  doAction ("Unapply one patch")  // same action as clicking on the toolbar icon

Else If (selectedPatches.length == 1 AND selectedPatches(0).isApplied == true) // single applied patch selected
  // “Unapply up to this patch”
  If (patch(selectedPatch.index - 1).exists == true) // If there’s an applied patch below the selected patch…
    doAction (“Go to patch(selectedPatch.index - 1)”) // use existing action to unapply topmost patches
  Else // if only qbase is selected,
    doAction (“Unapply all patches”) // use existing action: unapply all
  End if

Else If (selection.isContiguous == true) // multiple and contiguous selection
  For each (selPatch of selectedPatches)
    If selPatch.isQtip 
      selectionContainsQtip = true
    If selPatch.isQbase
      selectionContainsQbase = true
  End for
  If (selectionContainsQtip == true AND selectionContainsQbase = true) // all applied patches are selected
    doAction(“Unapply all patches”) // use existing action: unapply all
  Else if (selectionContainsQtip == true)
    doAction(“Go to patch (selectedPatches.length)”) // use existing action to unapply topmost selected patches
                                                     // by going to the patch below the selection
  Else // contiguous selection excluding qtip
    return // do nothing
  End if

Else // multiple, con-contiguous selection
    return // do nothing
End if

Or by analogy to disable our new command for those cases where the pseudo code has return.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking