nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: bower/bower
Pull request #2248 (2016-04-12 16:31:20)

Add support for registering package with github's orgname/reponame
Implements #1857

sheerun: Thanks!

Patch:
diff --git a/lib/commands/register.js b/lib/commands/register.js
index 9c096a3b..da9d0d2c 100644
--- a/lib/commands/register.js
+++ b/lib/commands/register.js
@@ -4,16 +4,23 @@ var PackageRepository = require('../core/PackageRepository');
 var createError = require('../util/createError');
 var defaultConfig = require('../config');
 
-function register(logger, name, url, config) {
+function register(logger, name, source, config) {
     var repository;
     var registryClient;
     var force;
+    var url;
+    var githubSourceRegex = /^\w[\w-]+\/\w[\w-]+$/;
+    var getGithubUrl = function(source) {
+        return 'git@github.com:' + source + '.git';
+    };
 
     config = defaultConfig(config);
     force = config.force;
 
     name = (name || '').trim();
-    url = (url || '').trim();
+    source = (source || '').trim();
+
+    url = source.match(githubSourceRegex) ? getGithubUrl(source) : source;
 
     // Bypass any cache
     config.offline = false;


Test patch:
diff --git a/test/commands/register.js b/test/commands/register.js
index c677ed95..3d3b2d3f 100644
--- a/test/commands/register.js
+++ b/test/commands/register.js
@@ -86,6 +86,19 @@ describe('bower register', function () {
         });
     });
 
+    it('should call registry client with name and github source', function () {
+        mainPackage.prepare();
+
+        var register = registerFactory(mainPackage.path, mainPackage.meta());
+        return helpers.run(register, ['some-name', 'some-repo/package'])
+        .spread(function (result) {
+            expect(result).to.eql({
+                // Result from register action on stub
+                name: 'some-name', url: 'git@github.com:some-repo/package.git'
+            });
+        });
+    });
+
     it('should confirm in interactive mode', function () {
         mainPackage.prepare();
Repository: bower/bower
Pull request #2249 (2016-04-12 17:04:05)

Support single-char repo names and package names
This is a follow-up to the #2248.


Patch:
diff --git a/lib/commands/register.js b/lib/commands/register.js
index da9d0d2c..72808d3d 100644
--- a/lib/commands/register.js
+++ b/lib/commands/register.js
@@ -9,7 +9,7 @@ function register(logger, name, source, config) {
     var registryClient;
     var force;
     var url;
-    var githubSourceRegex = /^\w[\w-]+\/\w[\w-]+$/;
+    var githubSourceRegex = /^\w[\w-]*\/\w[\w-]*$/;
     var getGithubUrl = function(source) {
         return 'git@github.com:' + source + '.git';
     };


Test patch:
diff --git a/test/commands/register.js b/test/commands/register.js
index 3d3b2d3f..01f56231 100644
--- a/test/commands/register.js
+++ b/test/commands/register.js
@@ -90,11 +90,24 @@ describe('bower register', function () {
         mainPackage.prepare();
 
         var register = registerFactory(mainPackage.path, mainPackage.meta());
-        return helpers.run(register, ['some-name', 'some-repo/package'])
+        return helpers.run(register, ['some-name', 'some-name/repo'])
         .spread(function (result) {
             expect(result).to.eql({
                 // Result from register action on stub
-                name: 'some-name', url: 'git@github.com:some-repo/package.git'
+                name: 'some-name', url: 'git@github.com:some-name/repo.git'
+            });
+        });
+    });
+
+    it('should support single-char github names', function () {
+        mainPackage.prepare();
+
+        var register = registerFactory(mainPackage.path, mainPackage.meta());
+        return helpers.run(register, ['some-name', 'a/b'])
+        .spread(function (result) {
+            expect(result).to.eql({
+                // Result from register action on stub
+                name: 'some-name', url: 'git@github.com:a/b.git'
             });
         });
     });
Repository: bower/bower
Pull request #2252 (2016-04-13 19:55:41)

Implement postuninstall hooks with tests
Implements feature from #1451.

oskarcieslik: I know somebody already pushed PR with this but mine passes tests and I want this feature in bower :)
sheerun: Could you create new test instead modifying existing one?
oskarcieslik: Sure! working on it 
oskarcieslik: Btw, any idea why tests are not running on my PRs @sheerun?
sheerun: I think there were permission issues with travis, should be fixed now

Patch:
diff --git a/lib/core/Project.js b/lib/core/Project.js
index 50bdee4d..2c4f3410 100644
--- a/lib/core/Project.js
+++ b/lib/core/Project.js
@@ -764,6 +764,9 @@ Project.prototype._removePackages = function (packages) {
     .then(function () {
         return that.saveJson();
     })
+    // Run post-uninstall hook before resolving with removed packages.
+    .then(scripts.postuninstall.bind(
+        null, that._config, that._logger, packages, that._installed, that._json))
     // Resolve with removed packages
     .then(function () {
         return mout.object.filter(packages, function (dir) {
diff --git a/lib/core/scripts.js b/lib/core/scripts.js
index 15b9b647..d0e7d42a 100644
--- a/lib/core/scripts.js
+++ b/lib/core/scripts.js
@@ -89,6 +89,7 @@ var hook = function (action, ordered, config, logger, packages, installed, json)
 
 module.exports = {
     preuninstall: mout.function.partial(hook, 'preuninstall', false),
+    postuninstall: mout.function.partial(hook, 'postuninstall', false),
     preinstall: mout.function.partial(hook, 'preinstall', true),
     postinstall: mout.function.partial(hook, 'postinstall', true),
     //only exposed for test


Test patch:
diff --git a/test/core/scripts.js b/test/core/scripts.js
index 2f191ccf..1e152f23 100644
--- a/test/core/scripts.js
+++ b/test/core/scripts.js
@@ -27,7 +27,8 @@ describe('scripts', function () {
         scripts: {
             preinstall: touch('preinstall_%_%'),
             postinstall: touch('postinstall_%_%'),
-            preuninstall: touch('preuninstall_%_%')
+            preuninstall: touch('preuninstall_%_%'),
+            postuninstall: touch('postuninstall_%_%')
         }
     };
 
@@ -66,6 +67,19 @@ describe('scripts', function () {
 
     });
 
+    it('should run postuninstall hook.', function (next) {
+
+        bower.commands
+        .uninstall([packageName], undefined, config)
+        .on('end', function (installed) {
+
+            expect(fs.existsSync(path.join(tempDir, 'postuninstall_' + packageName + '_' + packageName))).to.be(true);
+
+            next();
+        });
+
+    });
+
     it('should not break anything when no hooks configured.', function (next) {
 
         bower.commands
Repository: bower/bower
Pull request #2322 (2016-07-04 10:36:39)

Allow `@` to be used as a divider with cli: install and info.
`@` is replaced with `#` as part of the `info` and `install` commands.

wookoouk: is the appveyer branch test working? it has not reported on the last 4-5 PRs *Waiting for status to be reported*

Patch:
diff --git a/lib/commands/info.js b/lib/commands/info.js
index 850360ef..28cac378 100644
--- a/lib/commands/info.js
+++ b/lib/commands/info.js
@@ -9,6 +9,9 @@ function info(logger, endpoint, property, config) {
         return;
     }
 
+    // handle @ as version divider
+    endpoint = endpoint.replace('@', '#');
+
     var repository;
     var decEndpoint;
 
diff --git a/lib/commands/install.js b/lib/commands/install.js
index c3d0489e..6e6b6fc5 100644
--- a/lib/commands/install.js
+++ b/lib/commands/install.js
@@ -16,6 +16,8 @@ function install(logger, endpoints, options, config) {
     // Convert endpoints to decomposed endpoints
     endpoints = endpoints || [];
     decEndpoints = endpoints.map(function (endpoint) {
+        // handle @ as version divider
+        endpoint = endpoint.replace('@', '#');
         return endpointParser.decompose(endpoint);
     });
 


Test patch:
diff --git a/test/commands/info.js b/test/commands/info.js
index 8dcc6469..60e39135 100644
--- a/test/commands/info.js
+++ b/test/commands/info.js
@@ -49,4 +49,17 @@ describe('bower info', function () {
             });
         });
     });
+    it('should handle @ as a divider', function () {
+        return helpers.run(info, [mainPackage.path + '@0.1.3']).spread(function (results) {
+            expect(results).to.eql(
+                {
+                    name: 'package',
+                    version: '0.1.3',
+                    homepage: 'http://bower.io',
+                    description: 'Hello world! Hello!'
+                }
+            );
+        });
+
+    });
 });
diff --git a/test/commands/install.js b/test/commands/install.js
index e37059b2..c35b6674 100644
--- a/test/commands/install.js
+++ b/test/commands/install.js
@@ -726,4 +726,13 @@ describe('bower install', function () {
             expect(tempDir.read(path.join('bower_components', 'package', 'package.tar'))).to.contain('test');
         });
     });
+    it('should handle @ as a divider', function () {
+        return helpers.run(install, [
+            ['empty@1.0.1'], {
+                save: true
+            }
+        ]).then(function () {
+            expect(tempDir.readJson('bower.json').dependencies).to.eql({empty: '1.0.1'});
+        });
+    });
 });