Code Monkey home page Code Monkey logo

azure-repos-pr-multi-cherry-pick's Introduction

Multi Cherry-Pick Tool

Build Status Release Status

This tool offers an easy way to use the git cherry-pick operation to apply changes to multiple branches. For each branch selected, a new topic branch will be created with the applied changes. If the Pull request option is selected, a pull request will be opened to the target branch.

Screen Shot 2019-05-13 at 1 00 27 PMScreen Shot 2019-05-13 at 1 00 46 PM

Quick steps to get started using the tool

  1. Install the extension from the marketplace into your Azure DevOps organization.
  2. Navigate to your pull request.
  3. Select the context menu (...)
  4. Select Multi-cherry-pick.

Screen Shot 2019-05-10 at 4 20 10 PM

  1. Add as many cherry-pick targets as you would like.
  2. After you click Complete, a summary page will appear with links to branches and PRs created from the tool.

Technologies used to develop the extension

  • Code written in Typescript; styling defined using SASS.
  • Webpack for watching and building files during development, and for building optimized bundles for production.
  • React for rendering a complex UI with user interaction.

How to build

Download the required tools

You will need:

Prereq: Organization permission level

  • To develop and test the extension, you will need an organization in which you have permission to install extensions (e.g. you are the owner).
  • If you don't have a personal organization, you can create an organization for free.

Prereq: Node and NPM

From a terminal ensure at least node 10.15 and npm 6.9. Use the following command to figure out what version you have installed locally:

node -v && npm -v

The following should appear in your terminal:

v10.15.0
6.9.0

To install npm separately and verify that it installed properly:

[sudo] npm install npm@6 -g
npm -v

Note: On Windows, if it's still returning npm 2.x, run where npm. Notice hits in program files. Rename those two npm files and the 5.6.0 in AppData will win.

Prereq: Create a publisher

All extensions, including extensions from Microsoft, live under a publisher. Anyone can create a publisher and publish extensions under it. You can also give other people access to your publisher if a team is developing the extension.

You will do one of two things:

  • Sign in to the Visual Studio Marketplace management portal
  • If you don't already have a publisher, you'll be prompted to create one. Learn how to create one here

Install dependencies

Run this command once:

npm install

Build the Extension

This extension uses webpack for bundling and webpack-dev-server for watching files and serving bundles during development. Two bundles are defined for webpack: one for the main dialog and one for the extension context menu registration. All actions can be triggered using npm scripts (npm run <target>) with no additional task runner required.

Deploy the Extension

You will need to deploy your extension to the marketplace at least once so that you can share it with your organization and install it. In order to do this, you will need to generate a personal access token (PAT). Learn how to do that here. When creating your PAT, under Organization, select All accessible organizations, and set the Marketplace scope to Publish.

Then run once, inserting your PAS into [token]:

npm run publish:dev --  --token [token]

You will then need to install and share your extension, learn how to do that here.

Once the extension is installed, you will notice that it won’t load correctly. It isn't loading because we configured it to load all its resources (html, images, etc.) from localhost:3000, but there is no server running yet.

To start webpack-dev-server run:

npm run start:dev

Now if you go to localhost:3000 in your browser, you should get an untrusted certificate error page. Select Advanced and then trust the certificate. Go back to Azure DevOps and your extension should now load correctly and any changes to the source code will cause webpack to recompile and reload the extension automatically.

Although most code changes will be reflected immediately, you may still need to occasionally update your extension in the marketplace. The dev extension loads all its resources from the webpack-dev-server, but the manifest itself is being loaded from the published code. Therefore, any changes to the manifest file will not be properly reflected in Azure DevOps until the extension has been republished.

Configure your VS Code project to debug against Azure DevOps

In VS Code, press F5 to start debugging (making sure the webpack-dev-server is still running). The default launch configuration should be set to Firefox.

Note: Chrome configurations are included in the sample as well in case the Chrome debugging extension eventually supports iframes. However, debugging iframes is only supported in the Debugger for Firefox extension for now.

Once Firefox starts up, you will have to go through the steps of allowing the localhost:3000 certificate again and log into your Azure DevOps account. From now on, if you leave this Firefox window open, the debugger will reattach instead of starting a clean Firefox instance each time.

Once you are logged in to Azure DevOps, your extension should be running. Set a breakpoint in a method in VS Code and you should see that breakpoint hit when that method executes.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

azure-repos-pr-multi-cherry-pick's People

Contributors

begonaguereca avatar dependabot[bot] avatar ethanis avatar jenniferkerns avatar matissehack avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar msftgits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-repos-pr-multi-cherry-pick's Issues

Unable to install PR Multi-Cherry-Pick extension

Error log

4/4/2022 8:24:48 PM - Microsoft VSIX Installer
4/4/2022 8:24:48 PM - -------------------------------------------
4/4/2022 8:24:48 PM - vsixinstaller.exe version:
4/4/2022 8:24:48 PM - 17.1.1035-preview2
4/4/2022 8:24:48 PM - -------------------------------------------
4/4/2022 8:24:48 PM - Command line parameters:
4/4/2022 8:24:48 PM - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\Users\ankumari\Downloads\1ESLighthouseEng.pr-multi-cherry-pick-1.0.0.73.vsix
4/4/2022 8:24:48 PM - -------------------------------------------
4/4/2022 8:24:48 PM - Microsoft VSIX Installer
4/4/2022 8:24:48 PM - -------------------------------------------
4/4/2022 8:24:49 PM - Initializing Install...
4/4/2022 8:24:49 PM - Extension Details...
4/4/2022 8:24:49 PM - Identifier : pr-multi-cherry-pick
4/4/2022 8:24:49 PM - Name : PR Multi-Cherry-Pick
4/4/2022 8:24:49 PM - Author : 1eslighthouseeng
4/4/2022 8:24:49 PM - Version : 1.0.0.73
4/4/2022 8:24:49 PM - Description : Cherry-pick a PR's commits into multiple branches at once
4/4/2022 8:24:49 PM - Locale : en-US
4/4/2022 8:24:49 PM - MoreInfoURL :
4/4/2022 8:24:49 PM - InstalledByMSI : False
4/4/2022 8:24:49 PM - SupportedFrameworkVersionRange : [0.0,2147483647.2147483647]
4/4/2022 8:24:49 PM -
4/4/2022 8:24:49 PM - SignatureState : Unsigned
4/4/2022 8:24:49 PM - Supported Products :
4/4/2022 8:24:49 PM - Microsoft.VisualStudio.Services
4/4/2022 8:24:49 PM - Version :
4/4/2022 8:24:49 PM - ProductArchitecture : x86
4/4/2022 8:24:49 PM -
4/4/2022 8:24:49 PM - References :
4/4/2022 8:24:49 PM - Signature Details...
4/4/2022 8:24:49 PM - Extension is not signed.
4/4/2022 8:24:49 PM -
4/4/2022 8:24:49 PM - Searching for applicable products...
4/4/2022 8:24:49 PM - Found installed product - Global Location
4/4/2022 8:24:49 PM - Found installed product - Visual Studio Enterprise 2022
4/4/2022 8:24:49 PM - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
at VSIXInstaller.ExtensionService.GetInstallableDataImpl(IInstallableExtension extension, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable1& skuData) at VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable1& skuData)
at VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported)
at VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
at VSIXInstaller.App.Initialize()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Modify PR's fields

Hi,

I really appreciate this extension, because we had to do multiples cherry-picks sometimes (~10).

But, we had to modify too the title, the description and the work items linked to the PR. And we can't do this for now.

I'll keep watching this evo about these issues.

Thanks for this work.

Dropdown of target branch displays not existing branches

The dropdown list of Target Branch field lists branches that do no longer exist:
image

Existing branches:
image

Using the Cherry-pick button (standard functionality) these branches are not displayed:
image

Note: I marked the no longer existing branches as favorites in the past. It seems that this information is already available and used for composing the list of branches that is displayed in the drowdown.

Feature request: cherry-pick multiple commits to a single branch

This extension seems like a natural place to implement some UI that allows the user to specify a range or list of commits for the source.commits parameter to the cherryPicks API. The user should select a commit to cherry-pick; enter the target and topic branch as they do now; and then be allowed to search additional commits to add to the cherry-picked branch.

The use case in mind is f.ex. if a feature branch has commits A, B, C, D ahead of master; but you want only B, C, and D to be merged to master. Currently you have to cherry-pick each commit separately; this would save a lot of clicks.

No dialog appears and HTTP 404 error

Hi there,

Thank you for making this extension available. 😄
Could you offer any advice on the following issue we are experiencing? We are eager to use this extension to streamline our workflow, so your help would be most appreciated.

Steps to Reproduce:

Environment: Chrome and Edge browsers, Azure DevOps Server 2019.0.1 (Version 17.143.28912.1)

  1. In the Azure DevOps web portal, navigate to the pull request Overview.
  2. Choose Multi-cherry-pick... from the ellipsis drop-down.

Results:

  • The Multi-cherry-pick dialog does not appear.
  • The browser console reports an HTTP 404 in response to the /_apis/git/pullRequests/ GET request.

Screen Capture:

multi-cherry-pick-error

404 (Not Found) error when using the extension

Hi,

I want to use the extensions with Azure DevOps Server 2019, but when I use the button I get an 404 (Not Found) error.

Fetch.js:116 GET https://tfs01/tfs/DefaultCollection/_apis/git/pullRequests/8682 404 (Not Found)

Rejected XDM promise with no reject callbacks (Fetch.js:116)

{stack: "TFS.WebApi.Exception: 404: Not Found↵    at Object…ick/1.0.0.46/assetbyname/dist/src/app.js:8:66770)", name: "TFS.WebApi.Exception", status: 404, responseText: "Page not found.", message: "404: Not Found", …}
message: "404: Not Found"
name: "TFS.WebApi.Exception"
responseText: "Page not found."
stack: "TFS.WebApi.Exception: 404: Not Found↵    at Object.<anonymous> (https://tfs01/tfs/_apis/public/gallery/publisher/1eslighthouseeng/extension/pr-multi-cherry-pick/1.0.0.46/assetbyname/dist/src/app.js:8:69394)↵    at https://tfs01/tfs/_apis/public/gallery/publisher/1eslighthouseeng/extension/pr-multi-cherry-pick/1.0.0.46/assetbyname/dist/src/app.js:8:67919↵    at Object.next (https://tfs01/tfs/_apis/public/gallery/publisher/1eslighthouseeng/extension/pr-multi-cherry-pick/1.0.0.46/assetbyname/dist/src/app.js:8:68024)↵    at s (https://tfs01/tfs/_apis/public/gallery/publisher/1eslighthouseeng/extension/pr-multi-cherry-pick/1.0.0.46/assetbyname/dist/src/app.js:8:66770)"
status: 404

When I manually make a GET request to the URL it works.
We are using a self signed certificate for our server. Maybe this can make a problem for the plugin?

Thanks for the plugin 👍

Feature request: clone linked work items

When we cherry-pick a change across release branches we don't have a good mechanism for bug tracking. If we use the same bug for each cherry-pick PR then it is easier to track the dev work from a single bug but it also means we cannot use any of the 'auto-resolve' type features of Azure DevOps on PR completion (or if the PR uses verbiage like 'fixes #123') because otherwise if one branch PR completes and autoresolves the linked work item then it may appear safe to ship even though the other branch's PRs failed to complete.

Is it possible to add an option on the multi cherry-pick UI to have each PR clone the work item from the existing PR and link that one instead? Adding the branch name into the bug title and/or as a metadata tag on the bug would differentiate them.

Feature request: Support for workflow with forks

We are using forking workflow where external developers are using their forks of our main repository. They are then submitting PRs from their fork to our reposity. The usual stuff.

At the same time we are supporting multiple versions of our product so every bugfix must be cherrypicked to multiple branches.

Default behaviour when cherrypicking creates new branch in target repository with cherrypicked commits. And generally we can't give external users rights to create new branches in main repository. This is the issue which prevents us (external developers) from using cherrypicking with forks.

Possible solution:
Allow user to choose repository were new branch should be created when source repository != target repository.

Thank you for consideration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.