PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: bazelbuild/bazelisk (go)

Issue:
last_rc is broken
~/bazelisk/bazelisk (master) USE_BAZEL_VERSION=last_rc bazel-bin/bazelisk_/bazelisk
2020/10/22 15:37:03 could not download Bazel: '3.7.0release' does not refer to a release candidate


Pull request:
Discard releases when reading candidates
This commit fixes two related problems: when version equaled "last_rc", Bazelisk-Go did not discard release versions, and it returned the "release" suffix as part of the version label (which was invalid, of course).

Fixes #189

Patch:
diff --git a/repositories/gcs.go b/repositories/gcs.go
index 75359f4..57dc28f 100644
--- a/repositories/gcs.go
+++ b/repositories/gcs.go
@@ -82,7 +82,8 @@ func listDirectoriesInReleaseBucket(prefix string) ([]string, bool, error) {
 func getVersionsFromGCSPrefixes(versions []string) []string {
 	result := make([]string, len(versions))
 	for i, v := range versions {
-		result[i] = strings.ReplaceAll(v, "/", "")
+		noSlashes := strings.ReplaceAll(v, "/", "")
+		result[i] =  strings.TrimSuffix(noSlashes, "release")
 	}
 	return result
 }
@@ -163,7 +164,14 @@ func (gcs *GCSRepo) GetCandidateVersions(bazeliskHome string) ([]string, error)
 		return []string{}, fmt.Errorf("could not list release candidates for latest release: %v", err)
 	}
 
-	return getVersionsFromGCSPrefixes(rcPrefixes), nil
+	rcs := make([]string, 0)
+	for _, v := range getVersionsFromGCSPrefixes(rcPrefixes) {
+		// Remove full releases
+		if strings.Contains(v, "rc") {
+			rcs = append(rcs, v)
+		}
+	}
+	return rcs, nil
 }
 
 // DownloadCandidate downloads the given release candidate into the specified location and returns the absolute path.


Test patch:
diff --git a/bazelisk_version_test.go b/bazelisk_version_test.go
index 2698780..620aabe 100644
--- a/bazelisk_version_test.go
+++ b/bazelisk_version_test.go
@@ -59,6 +59,24 @@ func TestResolveLatestRcVersion(t *testing.T) {
 	}
 }
 
+func TestResolveLatestRcVersion_WithFullRelease(t *testing.T) {
+	s := setUp(t)
+	s.AddVersion("4.0.0", true, 1, 2, 3)
+	s.Finish()
+
+	gcs := &repositories.GCSRepo{}
+	repos := core.CreateRepositories(nil, gcs, nil, nil, false)
+	version, _, err := repos.ResolveVersion(tmpDir, versions.BazelUpstream, "last_rc")
+
+	if err != nil {
+		t.Fatalf("Version resolution failed unexpectedly: %v", err)
+	}
+	expectedRC := "4.0.0rc3"
+	if version != expectedRC {
+		t.Fatalf("Expected version %s, but got %s", expectedRC, version)
+	}
+}
+
 func TestResolveLatestVersion_TwoLatestVersionsDoNotHaveAReleaseYet(t *testing.T) {
 	s := setUp(t)
 	s.AddVersion("4.0.0", true)
Repository: scala-steward-org/scala-steward (scala)

Issue:
Version.selectNext fails to recognize hashes with a "g" prefix
Here is an update (from 0.0.12 to 0.0.12-3-g699a2cf) that would not have happened if Scala Steward would have recognized the hash in the version: https://github.com/raster-foundry/granary/pull/360

The "g" prefix comes from [git describe](https://git-scm.com/docs/git-describe#_examples):
> The hash suffix is "-g" + unambiguous abbreviation for the tip commit of parent (which was 2414721b194453f058079d897d13c4e377f92dc6). The "g" prefix stands for "git" and is used to allow describing the version of a software depending on the SCM the software is managed with. This is useful in an environment where people may use different SCMs.

Pull request:
Closes #1561.

Patch:
diff --git a/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala b/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala
index d39012ed07..2e603a107a 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala
@@ -87,7 +87,7 @@ final case class Version(value: String) {
   }
 
   private[this] def hashIndex: Option[NonNegInt] =
-    """[-+]\p{XDigit}{6,}""".r.findFirstMatchIn(value).flatMap(m => NonNegInt.unapply(m.start))
+    """[-+]g?\p{XDigit}{6,}""".r.findFirstMatchIn(value).flatMap(m => NonNegInt.unapply(m.start))
 
   private val minAlphaOrder: Int =
     alnumComponents.collect { case a: Version.Component.Alpha => a.order }.minOption.getOrElse(0)


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala b/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
index 9c955c3c96..fe3fdcf67a 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
@@ -196,6 +196,7 @@ class VersionTest
       ("2.2.0", List("2.2.0-0-fe5ed67", "2.2.0-4-4bd225e"), None),
       ("0.116.0-alpha", List("0.118.1-alpha"), None),
       ("0.8.0", List("0.8.0-1-d81662"), None),
+      ("0.0.12", List("0.0.12-3-g699a2cf"), None),
       ("0.6.3", List("289f9e3aa3f5014a5c64319da8e6ab993947ade2-0-289f9e"), None),
       ("0.1-58d9629", List("0.8.0"), Some("0.8.0")),
       ("0.9-a3bf234", List("0.14-9419610"), Some("0.14-9419610")),
Repository: python/bedevere (python)

Issue:
Add docs label for PRs that touch Doc/tools/.nitignore
See e.g. https://github.com/python/cpython/pull/114280 or https://github.com/python/cpython/pull/114194

Pull request:
Add the "docs" label also for Doc/*/.nitignore
Closes #616

Patch:
diff --git a/bedevere/prtype.py b/bedevere/prtype.py
index 0105e50..bccd879 100644
--- a/bedevere/prtype.py
+++ b/bedevere/prtype.py
@@ -43,7 +43,7 @@ async def classify_by_filepaths(gh, pull_request, filenames):
         if util.is_news_dir(filename):
             news = True
         filepath = pathlib.PurePath(filename)
-        if filepath.suffix == ".rst":
+        if filepath.suffix == ".rst" or filepath.name == ".nitignore":
             docs = True
         elif filepath.name.startswith("test_"):
             tests = True


Test patch:
diff --git a/tests/test_prtype.py b/tests/test_prtype.py
index 4fcaf0c..c9b0777 100644
--- a/tests/test_prtype.py
+++ b/tests/test_prtype.py
@@ -85,6 +85,26 @@ async def test_docs_no_news():
     assert gh.post_data[0] == [Labels.docs.value, Labels.skip_news.value]
 
 
+async def test_docs_no_news_with_dotnitignore():
+    filenames = {"path/to/docs1.rst", "path/to/.nitignore"}
+    issue = {"labels": [], "labels_url": "https://api.github.com/some/label"}
+    gh = FakeGH(getitem=issue)
+    event_data = {
+        "action": "opened",
+        "number": 1234,
+        "pull_request": {
+            "url": "https://api.github.com/repos/cpython/python/pulls/1234",
+            "statuses_url": "https://api.github.com/some/status",
+            "issue_url": "https://api.github.com/repos/cpython/python/issue/1234",
+        },
+    }
+    await prtype.classify_by_filepaths(gh, event_data["pull_request"], filenames)
+    assert gh.getitem_url == "https://api.github.com/repos/cpython/python/issue/1234"
+    assert len(gh.post_url) == 1
+    assert gh.post_url[0] == "https://api.github.com/some/label"
+    assert gh.post_data[0] == [Labels.docs.value, Labels.skip_news.value]
+
+
 async def test_docs_and_news():
     filenames = {"/path/to/docs1.rst", f"Misc/NEWS.d/next/Lib/{GOOD_BASENAME}"}
     issue = {"labels": [], "labels_url": "https://api.github.com/some/label"}
Repository: rust-lang/rustfmt (rust)

Issue:
Incorrectly strips r# prefix from labels
Rust playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=051766b3584e787d3abab1d2f18424bb

The following code:

```rust
'r#if: {
  break 'r#if;
}
```

when run through either stable or nightly rustfmt will incorrectly be formatted into this:

```rust
'r#if: {
  break 'if;
}
```

which rustc will complain because `'if` is an invalid label name:

```rust
error: invalid label name `'if`
 --> src/main.rs:5:15
  |
5 |         break 'if;
  |               ^^^
```

Note that this still does occur if the label name is not a keyword:

```rust
'r#a: {
  break 'r#a;
}
```

is formatted into

```rust
'r#a: {
  break 'a;
}
```

However this does not cause an error.

Versions of `rustfmt` (from rust-playground)
```1.8.0-stable (2024-11-26 90b35a6239)```
and
```1.8.0-nightly (2024-11-30 7442931d49)```

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":"sobatha"}$$TRIAGEBOT_ASSIGN_DATA_END -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->

Pull request:
Fix incorrect strip r# prefix from labels
This PR fix #6411 

This PR fixes an issue where rustfmt incorrectly removes the r# prefix in raw labels(introduced in 1.83 https://github.com/rust-lang/rust/pull/126452), causing invalid label names like 'if instead of 'r#if. 

Patch:
diff --git a/src/expr.rs b/src/expr.rs
index 068af184..0751d65a 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -200,14 +200,22 @@ pub(crate) fn format_expr(
         }
         ast::ExprKind::Continue(ref opt_label) => {
             let id_str = match *opt_label {
-                Some(label) => format!(" {}", label.ident),
+                Some(label) => {
+                    // Ident lose the `r#` prefix in raw labels,　so use the original snippet
+                    let label_name = context.snippet(label.ident.span);
+                    format!(" {}", label_name)
+                }
                 None => String::new(),
             };
             Ok(format!("continue{id_str}"))
         }
         ast::ExprKind::Break(ref opt_label, ref opt_expr) => {
             let id_str = match *opt_label {
-                Some(label) => format!(" {}", label.ident),
+                Some(label) => {
+                    // Ident lose the `r#` prefix in raw labels,　so use the original snippet
+                    let label_name = context.snippet(label.ident.span);
+                    format!(" {}", label_name)
+                }
                 None => String::new(),
             };
 


Test patch:
diff --git a/tests/target/issue-6411.rs b/tests/target/issue-6411.rs
new file mode 100644
index 00000000..a1166a74
--- /dev/null
+++ b/tests/target/issue-6411.rs
@@ -0,0 +1,21 @@
+// rustfmt-edition: 2021
+
+fn test_break() {
+    'r#if: {
+        break 'r#if;
+    }
+
+    'r#a: {
+        break 'r#a;
+    }
+}
+
+fn test_continue() {
+    'r#if: {
+        continue 'r#if;
+    }
+
+    'r#a: {
+        continue 'r#a;
+    }
+}